aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/qml/CMakeLists.txt2
-rw-r--r--examples/qml/doc/src/qml-extending.qdoc25
-rw-r--r--examples/qml/referenceexamples/adding/main.cpp12
-rw-r--r--examples/qml/referenceexamples/adding/person.cpp8
-rw-r--r--examples/qml/referenceexamples/adding/person.h7
-rw-r--r--examples/qml/referenceexamples/attached/birthdayparty.cpp17
-rw-r--r--examples/qml/referenceexamples/attached/birthdayparty.h13
-rw-r--r--examples/qml/referenceexamples/attached/main.cpp15
-rw-r--r--examples/qml/referenceexamples/attached/person.cpp26
-rw-r--r--examples/qml/referenceexamples/attached/person.h16
-rw-r--r--examples/qml/referenceexamples/binding/birthdayparty.cpp20
-rw-r--r--examples/qml/referenceexamples/binding/birthdayparty.h13
-rw-r--r--examples/qml/referenceexamples/binding/happybirthdaysong.cpp5
-rw-r--r--examples/qml/referenceexamples/binding/happybirthdaysong.h4
-rw-r--r--examples/qml/referenceexamples/binding/main.cpp12
-rw-r--r--examples/qml/referenceexamples/binding/person.cpp26
-rw-r--r--examples/qml/referenceexamples/binding/person.h17
-rw-r--r--examples/qml/referenceexamples/coercion/birthdayparty.cpp13
-rw-r--r--examples/qml/referenceexamples/coercion/birthdayparty.h11
-rw-r--r--examples/qml/referenceexamples/coercion/main.cpp13
-rw-r--r--examples/qml/referenceexamples/coercion/person.cpp22
-rw-r--r--examples/qml/referenceexamples/coercion/person.h12
-rw-r--r--examples/qml/referenceexamples/default/birthdayparty.cpp12
-rw-r--r--examples/qml/referenceexamples/default/birthdayparty.h11
-rw-r--r--examples/qml/referenceexamples/default/main.cpp10
-rw-r--r--examples/qml/referenceexamples/default/person.cpp21
-rw-r--r--examples/qml/referenceexamples/default/person.h11
-rw-r--r--examples/qml/referenceexamples/grouped/birthdayparty.cpp13
-rw-r--r--examples/qml/referenceexamples/grouped/birthdayparty.h9
-rw-r--r--examples/qml/referenceexamples/grouped/main.cpp12
-rw-r--r--examples/qml/referenceexamples/grouped/person.cpp26
-rw-r--r--examples/qml/referenceexamples/grouped/person.h16
-rw-r--r--examples/qml/referenceexamples/methods/birthdayparty.cpp12
-rw-r--r--examples/qml/referenceexamples/methods/birthdayparty.h11
-rw-r--r--examples/qml/referenceexamples/methods/main.cpp11
-rw-r--r--examples/qml/referenceexamples/methods/person.cpp9
-rw-r--r--examples/qml/referenceexamples/methods/person.h8
-rw-r--r--examples/qml/referenceexamples/properties/birthdayparty.cpp28
-rw-r--r--examples/qml/referenceexamples/properties/birthdayparty.h23
-rw-r--r--examples/qml/referenceexamples/properties/main.cpp8
-rw-r--r--examples/qml/referenceexamples/properties/person.cpp9
-rw-r--r--examples/qml/referenceexamples/properties/person.h8
-rw-r--r--examples/qml/referenceexamples/signal/birthdayparty.cpp20
-rw-r--r--examples/qml/referenceexamples/signal/birthdayparty.h10
-rw-r--r--examples/qml/referenceexamples/signal/main.cpp12
-rw-r--r--examples/qml/referenceexamples/signal/person.cpp26
-rw-r--r--examples/qml/referenceexamples/signal/person.h16
-rw-r--r--examples/qml/referenceexamples/valuesource/birthdayparty.cpp21
-rw-r--r--examples/qml/referenceexamples/valuesource/birthdayparty.h14
-rw-r--r--examples/qml/referenceexamples/valuesource/happybirthdaysong.cpp8
-rw-r--r--examples/qml/referenceexamples/valuesource/happybirthdaysong.h7
-rw-r--r--examples/qml/referenceexamples/valuesource/main.cpp12
-rw-r--r--examples/qml/referenceexamples/valuesource/person.cpp26
-rw-r--r--examples/qml/referenceexamples/valuesource/person.h18
-rw-r--r--examples/qml/tutorials/extending-qml/chapter1-basics/CMakeLists.txt1
-rw-r--r--examples/qml/tutorials/extending-qml/chapter1-basics/piechart.h4
-rw-r--r--examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt1
-rw-r--r--examples/qml/tutorials/extending-qml/chapter2-methods/piechart.h4
-rw-r--r--examples/qml/tutorials/extending-qml/chapter3-bindings/CMakeLists.txt1
-rw-r--r--examples/qml/tutorials/extending-qml/chapter3-bindings/piechart.h4
-rw-r--r--examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/CMakeLists.txt1
-rw-r--r--examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.h4
-rw-r--r--examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h2
-rw-r--r--examples/qml/tutorials/extending-qml/chapter5-listproperties/CMakeLists.txt1
-rw-r--r--examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.h4
-rw-r--r--examples/qml/tutorials/extending-qml/chapter5-listproperties/pieslice.h6
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt3
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h4
-rw-r--r--examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h6
-rw-r--r--examples/quick/CMakeLists.txt7
-rw-r--r--examples/quick/customitems/painteditem/TextBalloon/CMakeLists.txt4
-rw-r--r--examples/quick/draganddrop/tiles/DragTile.qml2
-rw-r--r--examples/quick/embeddedinwidgets/CMakeLists.txt44
-rw-r--r--examples/quick/keyinteraction/CMakeLists.txt51
-rw-r--r--examples/quick/keyinteraction/ContextMenu.qml (renamed from examples/quick/keyinteraction/focus/Core/ContextMenu.qml)4
-rw-r--r--examples/quick/keyinteraction/GridMenu.qml (renamed from examples/quick/keyinteraction/focus/Core/GridMenu.qml)4
-rw-r--r--examples/quick/keyinteraction/ListMenu.qml (renamed from examples/quick/keyinteraction/focus/Core/ListMenu.qml)6
-rw-r--r--examples/quick/keyinteraction/ListViewDelegate.qml (renamed from examples/quick/keyinteraction/focus/Core/ListViewDelegate.qml)4
-rw-r--r--examples/quick/keyinteraction/TabMenu.qml (renamed from examples/quick/keyinteraction/focus/Core/TabMenu.qml)4
-rw-r--r--examples/quick/keyinteraction/focus.qml (renamed from examples/quick/keyinteraction/focus/focus.qml)9
-rw-r--r--examples/quick/keyinteraction/images/arrow.png (renamed from examples/quick/keyinteraction/focus/Core/images/arrow.png)bin411 -> 411 bytes
-rw-r--r--examples/quick/keyinteraction/images/qt-logo.png (renamed from examples/quick/keyinteraction/focus/Core/images/qt-logo.png)bin5149 -> 5149 bytes
-rw-r--r--examples/quick/keyinteraction/keyinteraction.qml6
-rw-r--r--examples/quick/keyinteraction/keyinteraction.qrc16
-rw-r--r--examples/quick/models/abstractitemmodel/CMakeLists.txt32
-rw-r--r--examples/quick/models/abstractitemmodel/abstractitemmodel.qrc2
-rw-r--r--examples/quick/models/abstractitemmodel/main.cpp4
-rw-r--r--examples/quick/models/abstractitemmodel/model.cpp2
-rw-r--r--examples/quick/models/abstractitemmodel/view.qml4
-rw-r--r--examples/quick/models/objectlistmodel/CMakeLists.txt32
-rw-r--r--examples/quick/models/objectlistmodel/dataobject.cpp2
-rw-r--r--examples/quick/models/objectlistmodel/main.cpp34
-rw-r--r--examples/quick/models/objectlistmodel/objectlistmodel.qrc2
-rw-r--r--examples/quick/models/objectlistmodel/view.qml13
-rw-r--r--examples/quick/models/stringlistmodel/CMakeLists.txt30
-rw-r--r--examples/quick/models/stringlistmodel/main.cpp2
-rw-r--r--examples/quick/models/stringlistmodel/stringlistmodel.qrc2
-rw-r--r--examples/quick/mousearea/CMakeLists.txt35
-rw-r--r--examples/quick/mousearea/mousearea-wheel-example.qml4
-rw-r--r--examples/quick/mousearea/mousearea.qml6
-rw-r--r--examples/quick/particles/affectors/CMakeLists.txt143
-rw-r--r--examples/quick/particles/affectors/GreyButton.qml (renamed from examples/quick/particles/affectors/content/GreyButton.qml)0
-rw-r--r--examples/quick/particles/affectors/affectors.pro1
-rw-r--r--examples/quick/particles/affectors/affectors.qml28
-rw-r--r--examples/quick/particles/affectors/affectors.qrc39
-rw-r--r--examples/quick/particles/affectors/age.qml (renamed from examples/quick/particles/affectors/content/age.qml)8
-rw-r--r--examples/quick/particles/affectors/attractor.qml (renamed from examples/quick/particles/affectors/content/attractor.qml)12
-rw-r--r--examples/quick/particles/affectors/customaffector.qml (renamed from examples/quick/particles/affectors/content/customaffector.qml)18
-rw-r--r--examples/quick/particles/affectors/doc/src/affectors.qdoc34
-rw-r--r--examples/quick/particles/affectors/friction.qml (renamed from examples/quick/particles/affectors/content/friction.qml)18
-rw-r--r--examples/quick/particles/affectors/gravity.qml (renamed from examples/quick/particles/affectors/content/gravity.qml)8
-rw-r--r--examples/quick/particles/affectors/groupgoal.qml (renamed from examples/quick/particles/affectors/content/groupgoal.qml)12
-rw-r--r--examples/quick/particles/affectors/images/_explo.png (renamed from examples/quick/particles/images/_explo.png)bin81528 -> 81528 bytes
-rw-r--r--examples/quick/particles/affectors/images/backgroundLeaves.jpg (renamed from examples/quick/particles/images/backgroundLeaves.jpg)bin78665 -> 78665 bytes
-rw-r--r--examples/quick/particles/affectors/images/candle.png (renamed from examples/quick/particles/images/candle.png)bin1348 -> 1348 bytes
-rw-r--r--examples/quick/particles/affectors/images/finalfrontier.png (renamed from examples/quick/particles/images/finalfrontier.png)bin695061 -> 695061 bytes
-rw-r--r--examples/quick/particles/affectors/images/matchmask.png (renamed from examples/quick/particles/images/matchmask.png)bin2369 -> 2369 bytes
-rw-r--r--examples/quick/particles/affectors/images/meteor.png (renamed from examples/quick/particles/images/meteor.png)bin83169 -> 83169 bytes
-rw-r--r--examples/quick/particles/affectors/images/nullRock.png (renamed from examples/quick/particles/images/nullRock.png)bin140 -> 140 bytes
-rw-r--r--examples/quick/particles/affectors/images/particleA.png (renamed from examples/quick/particles/images/particleA.png)bin870 -> 870 bytes
-rw-r--r--examples/quick/particles/affectors/images/realLeaf1.png (renamed from examples/quick/particles/images/realLeaf1.png)bin15625 -> 15625 bytes
-rw-r--r--examples/quick/particles/affectors/images/realLeaf2.png (renamed from examples/quick/particles/images/realLeaf2.png)bin13660 -> 13660 bytes
-rw-r--r--examples/quick/particles/affectors/images/realLeaf3.png (renamed from examples/quick/particles/images/realLeaf3.png)bin23809 -> 23809 bytes
-rw-r--r--examples/quick/particles/affectors/images/realLeaf4.png (renamed from examples/quick/particles/images/realLeaf4.png)bin23655 -> 23655 bytes
-rw-r--r--examples/quick/particles/affectors/images/rocket.png (renamed from examples/quick/particles/images/rocket.png)bin7315 -> 7315 bytes
-rw-r--r--examples/quick/particles/affectors/images/rocket2.png (renamed from examples/quick/particles/images/rocket2.png)bin1918 -> 1918 bytes
-rw-r--r--examples/quick/particles/affectors/images/snowflake.png (renamed from examples/quick/particles/images/snowflake.png)bin189327 -> 189327 bytes
-rw-r--r--examples/quick/particles/affectors/main.cpp2
-rw-r--r--examples/quick/particles/affectors/move.qml (renamed from examples/quick/particles/affectors/content/move.qml)0
-rw-r--r--examples/quick/particles/affectors/spritegoal.qml (renamed from examples/quick/particles/affectors/content/spritegoal.qml)14
-rw-r--r--examples/quick/particles/affectors/turbulence.qml (renamed from examples/quick/particles/affectors/content/turbulence.qml)6
-rw-r--r--examples/quick/particles/affectors/wander.qml (renamed from examples/quick/particles/affectors/content/wander.qml)6
-rw-r--r--examples/quick/particles/emitters/CMakeLists.txt126
-rw-r--r--examples/quick/particles/emitters/burstandpulse.qml (renamed from examples/quick/particles/emitters/content/burstandpulse.qml)0
-rw-r--r--examples/quick/particles/emitters/customemitter.qml (renamed from examples/quick/particles/emitters/content/customemitter.qml)0
-rw-r--r--examples/quick/particles/emitters/doc/src/emitters.qdoc12
-rw-r--r--examples/quick/particles/emitters/emitmask.qml (renamed from examples/quick/particles/emitters/content/emitmask.qml)2
-rw-r--r--examples/quick/particles/emitters/emitters.pro1
-rw-r--r--examples/quick/particles/emitters/emitters.qml22
-rw-r--r--examples/quick/particles/emitters/emitters.qrc18
-rw-r--r--examples/quick/particles/emitters/images/portal_bg.png (renamed from examples/quick/particles/images/portal_bg.png)bin96858 -> 96858 bytes
-rw-r--r--examples/quick/particles/emitters/images/starfish_mask.png (renamed from examples/quick/particles/images/starfish_mask.png)bin7403 -> 7403 bytes
-rw-r--r--examples/quick/particles/emitters/main.cpp2
-rw-r--r--examples/quick/particles/emitters/maximumemitted.qml (renamed from examples/quick/particles/emitters/content/maximumemitted.qml)0
-rw-r--r--examples/quick/particles/emitters/shapeanddirection.qml (renamed from examples/quick/particles/emitters/content/shapeanddirection.qml)2
-rw-r--r--examples/quick/particles/emitters/trailemitter.qml (renamed from examples/quick/particles/emitters/content/trailemitter.qml)0
-rw-r--r--examples/quick/particles/emitters/velocityfrommotion.qml (renamed from examples/quick/particles/emitters/content/velocityfrommotion.qml)0
-rw-r--r--examples/quick/particles/imageparticle/CMakeLists.txt132
-rw-r--r--examples/quick/particles/imageparticle/allatonce.qml (renamed from examples/quick/particles/imageparticle/content/allatonce.qml)10
-rw-r--r--examples/quick/particles/imageparticle/colored.qml (renamed from examples/quick/particles/imageparticle/content/colored.qml)6
-rw-r--r--examples/quick/particles/imageparticle/colortable.qml (renamed from examples/quick/particles/imageparticle/content/colortable.qml)10
-rw-r--r--examples/quick/particles/imageparticle/deformation.qml (renamed from examples/quick/particles/imageparticle/content/deformation.qml)10
-rw-r--r--examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc14
-rw-r--r--examples/quick/particles/imageparticle/imageparticle.pro1
-rw-r--r--examples/quick/particles/imageparticle/imageparticle.qml20
-rw-r--r--examples/quick/particles/imageparticle/imageparticle.qrc24
-rw-r--r--examples/quick/particles/imageparticle/images/bear_tiles.png (renamed from examples/quick/particles/images/bear_tiles.png)bin40349 -> 40349 bytes
-rw-r--r--examples/quick/particles/imageparticle/images/colortable.png (renamed from examples/quick/particles/images/colortable.png)bin571 -> 571 bytes
-rw-r--r--examples/quick/particles/imageparticle/images/flower.png (renamed from examples/quick/particles/images/flower.png)bin4683 -> 4683 bytes
-rw-r--r--examples/quick/particles/imageparticle/images/starfish_0.png (renamed from examples/quick/particles/images/starfish_0.png)bin15972 -> 15972 bytes
-rw-r--r--examples/quick/particles/imageparticle/images/starfish_1.png (renamed from examples/quick/particles/images/starfish_1.png)bin15746 -> 15746 bytes
-rw-r--r--examples/quick/particles/imageparticle/images/starfish_2.png (renamed from examples/quick/particles/images/starfish_2.png)bin16067 -> 16067 bytes
-rw-r--r--examples/quick/particles/imageparticle/images/starfish_3.png (renamed from examples/quick/particles/images/starfish_3.png)bin16201 -> 16201 bytes
-rw-r--r--examples/quick/particles/imageparticle/images/starfish_4.png (renamed from examples/quick/particles/images/starfish_4.png)bin14698 -> 14698 bytes
-rw-r--r--examples/quick/particles/imageparticle/main.cpp2
-rw-r--r--examples/quick/particles/imageparticle/rotation.qml (renamed from examples/quick/particles/imageparticle/content/rotation.qml)8
-rw-r--r--examples/quick/particles/imageparticle/sharing.qml (renamed from examples/quick/particles/imageparticle/content/sharing.qml)10
-rw-r--r--examples/quick/particles/imageparticle/sprites.qml (renamed from examples/quick/particles/imageparticle/content/sprites.qml)16
-rw-r--r--examples/quick/particles/images.qrc35
-rw-r--r--examples/quick/particles/images/meteor_explo.pngbin219946 -> 0 bytes
-rw-r--r--examples/quick/particles/images/meteors.pngbin132137 -> 0 bytes
-rw-r--r--examples/quick/particles/images/sizeInOut.pngbin132 -> 0 bytes
-rw-r--r--examples/quick/particles/itemparticle/CMakeLists.txt125
-rw-r--r--examples/quick/particles/itemparticle/content/Delegate.qml98
-rw-r--r--examples/quick/particles/itemparticle/content/Delegate2.qml89
-rw-r--r--examples/quick/particles/itemparticle/content/ExpandingDelegate.qml215
-rw-r--r--examples/quick/particles/itemparticle/content/bubble.pngbin2347 -> 0 bytes
-rw-r--r--examples/quick/particles/itemparticle/delegates.qml6
-rw-r--r--examples/quick/particles/itemparticle/images/rocket.pngbin0 -> 7315 bytes
-rw-r--r--examples/quick/particles/itemparticle/itemparticle.pro6
-rw-r--r--examples/quick/particles/itemparticle/itemparticle.qml (renamed from examples/quick/particles/itemparticle/particleview.qml)36
-rw-r--r--examples/quick/particles/itemparticle/itemparticle.qrc8
-rw-r--r--examples/quick/particles/itemparticle/main.cpp2
-rw-r--r--examples/quick/particles/itemparticle/script.js (renamed from examples/quick/particles/itemparticle/content/script.js)0
-rw-r--r--examples/quick/particles/particles.pro3
-rw-r--r--examples/quick/particles/system/CMakeLists.txt121
-rw-r--r--examples/quick/particles/system/doc/src/system.qdoc10
-rw-r--r--examples/quick/particles/system/dynamiccomparison.qml (renamed from examples/quick/particles/system/content/dynamiccomparison.qml)6
-rw-r--r--examples/quick/particles/system/dynamicemitters.qml (renamed from examples/quick/particles/system/content/dynamicemitters.qml)6
-rw-r--r--examples/quick/particles/system/images/particle2.png (renamed from examples/quick/particles/images/particle2.png)bin1073 -> 1073 bytes
-rw-r--r--examples/quick/particles/system/images/particle3.png (renamed from examples/quick/particles/images/particle3.png)bin574 -> 574 bytes
-rw-r--r--examples/quick/particles/system/images/sparkleSize.png (renamed from examples/quick/particles/images/sparkleSize.png)bin378 -> 378 bytes
-rw-r--r--examples/quick/particles/system/main.cpp2
-rw-r--r--examples/quick/particles/system/multiplepainters.qml (renamed from examples/quick/particles/system/content/multiplepainters.qml)10
-rw-r--r--examples/quick/particles/system/startstop.qml (renamed from examples/quick/particles/system/content/startstop.qml)8
-rw-r--r--examples/quick/particles/system/system.pro1
-rw-r--r--examples/quick/particles/system/system.qml18
-rw-r--r--examples/quick/particles/system/system.qrc15
-rw-r--r--examples/quick/particles/system/timedgroupchanges.qml (renamed from examples/quick/particles/system/content/timedgroupchanges.qml)6
-rw-r--r--examples/quick/pointerhandlers/CMakeLists.txt11
-rw-r--r--examples/quick/pointerhandlers/components/FakeFlickable.qml4
-rw-r--r--examples/quick/pointerhandlers/components/FlashAnimation.qml10
-rw-r--r--examples/quick/pointerhandlers/components/MomentumAnimation.qml2
-rw-r--r--examples/quick/pointerhandlers/components/MouseFeedbackSprite.qml2
-rw-r--r--examples/quick/pointerhandlers/components/ScrollBar.qml2
-rw-r--r--examples/quick/pointerhandlers/components/TouchpointFeedbackSprite.qml2
-rw-r--r--examples/quick/pointerhandlers/doc/images/pointerhandlers-example-fakeflickable.jpgbin0 -> 104984 bytes
-rw-r--r--examples/quick/pointerhandlers/doc/images/pointerhandlers-example-fling.webpbin0 -> 48514 bytes
-rw-r--r--examples/quick/pointerhandlers/doc/images/pointerhandlers-example-joystick.jpgbin0 -> 81973 bytes
-rw-r--r--examples/quick/pointerhandlers/doc/images/pointerhandlers-example-map.webpbin0 -> 424394 bytes
-rw-r--r--examples/quick/pointerhandlers/doc/images/pointerhandlers-example-mixer.webpbin0 -> 185554 bytes
-rw-r--r--examples/quick/pointerhandlers/doc/images/pointerhandlers-example-multibutton.webpbin0 -> 620084 bytes
-rw-r--r--examples/quick/pointerhandlers/doc/images/pointerhandlers-example-pinchhandler.webpbin0 -> 999018 bytes
-rw-r--r--examples/quick/pointerhandlers/doc/images/pointerhandlers-example-pointhandler.webpbin0 -> 286790 bytes
-rw-r--r--examples/quick/pointerhandlers/doc/images/pointerhandlers-example-taphandler.webpbin0 -> 155468 bytes
-rw-r--r--examples/quick/pointerhandlers/doc/src/pointerhandlers.qdoc184
-rw-r--r--examples/quick/pointerhandlers/fakeFlickable.qml2
-rw-r--r--examples/quick/pointerhandlers/flingAnimation.qml2
-rw-r--r--examples/quick/pointerhandlers/joystick.qml2
-rw-r--r--examples/quick/pointerhandlers/map.qml2
-rw-r--r--examples/quick/pointerhandlers/mixer.qml2
-rw-r--r--examples/quick/pointerhandlers/pinchHandler.qml2
-rw-r--r--examples/quick/pointerhandlers/sidebar.qml12
-rw-r--r--examples/quick/pointerhandlers/singlePointHandlerProperties.qml2
-rw-r--r--examples/quick/pointerhandlers/tabletCanvasDrawing.qml4
-rw-r--r--examples/quick/pointerhandlers/tapWithModifiers.qml2
-rw-r--r--examples/quick/positioners/positioners-attachedproperties.qml28
-rw-r--r--examples/quick/quickwidgets/qquickviewcomparison/main.cpp2
-rw-r--r--examples/quick/quickwidgets/quickwidget/main.cpp2
-rw-r--r--examples/quick/rendercontrol/rendercontrol_d3d11/CMakeLists.txt35
-rw-r--r--examples/quick/rendercontrol/rendercontrol_d3d11/demo.qml6
-rw-r--r--examples/quick/rendercontrol/rendercontrol_d3d11/main.cpp2
-rw-r--r--examples/quick/rendercontrol/rendercontrol_opengl/CMakeLists.txt39
-rw-r--r--examples/quick/rendercontrol/rendercontrol_opengl/demo.qml6
-rw-r--r--examples/quick/rendercontrol/rendercontrol_opengl/main.cpp2
-rw-r--r--examples/quick/scenegraph/d3d11underqml/d3d11squircle.cpp2
-rw-r--r--examples/quick/scenegraph/d3d11underqml/main.cpp2
-rw-r--r--examples/quick/scenegraph/fboitem/main.cpp2
-rw-r--r--examples/quick/scenegraph/graph/noisynode.cpp1
-rw-r--r--examples/quick/scenegraph/metaltextureimport/main.cpp2
-rw-r--r--examples/quick/scenegraph/metalunderqml/main.cpp2
-rw-r--r--examples/quick/scenegraph/metalunderqml/metalsquircle.mm2
-rw-r--r--examples/quick/scenegraph/openglunderqml/main.cpp2
-rw-r--r--examples/quick/scenegraph/openglunderqml/squircle.cpp2
-rw-r--r--examples/quick/scenegraph/vulkantextureimport/main.cpp2
-rw-r--r--examples/quick/scenegraph/vulkanunderqml/main.cpp2
-rw-r--r--examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp2
-rw-r--r--examples/quick/tutorials/dynamicview/CMakeLists.txt8
-rw-r--r--examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml2
-rw-r--r--examples/quick/tutorials/samegame/CMakeLists.txt8
-rw-r--r--examples/quickcontrols2/CMakeLists.txt18
-rw-r--r--examples/quickcontrols2/chattutorial/CMakeLists.txt10
-rw-r--r--examples/quickcontrols2/chattutorial/chapter1-settingup/CMakeLists.txt54
-rw-r--r--examples/quickcontrols2/chattutorial/chapter1-settingup/qml.qrc6
-rw-r--r--examples/quickcontrols2/chattutorial/chapter1/CMakeLists.txt44
-rw-r--r--examples/quickcontrols2/chattutorial/chapter1/chapter1.pro (renamed from examples/quickcontrols2/chattutorial/chapter1-settingup/chapter1-settingup.pro)7
-rw-r--r--examples/quickcontrols2/chattutorial/chapter1/main.cpp (renamed from examples/quickcontrols2/chattutorial/chapter3-navigation/main.cpp)2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter1/main.qml (renamed from examples/quickcontrols2/chattutorial/chapter1-settingup/main.qml)0
-rw-r--r--examples/quickcontrols2/chattutorial/chapter1/qtquickcontrols2.conf2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2-lists/CMakeLists.txt77
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2-lists/chapter2-lists.pro12
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2-lists/qml.qrc6
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/CMakeLists.txt57
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/chapter2.pro27
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/images/Albert_Einstein.png (renamed from examples/quickcontrols2/chattutorial/shared/Albert_Einstein.png)bin1669 -> 1669 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/images/Albert_Einstein@2x.png (renamed from examples/quickcontrols2/chattutorial/shared/Albert_Einstein@2x.png)bin5657 -> 5657 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/images/Albert_Einstein@3x.png (renamed from examples/quickcontrols2/chattutorial/shared/Albert_Einstein@3x.png)bin11804 -> 11804 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/images/Albert_Einstein@4x.png (renamed from examples/quickcontrols2/chattutorial/shared/Albert_Einstein@4x.png)bin19989 -> 19989 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/images/Ernest_Hemingway.png (renamed from examples/quickcontrols2/chattutorial/shared/Ernest_Hemingway.png)bin2255 -> 2255 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/images/Ernest_Hemingway@2x.png (renamed from examples/quickcontrols2/chattutorial/shared/Ernest_Hemingway@2x.png)bin6375 -> 6375 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/images/Ernest_Hemingway@3x.png (renamed from examples/quickcontrols2/chattutorial/shared/Ernest_Hemingway@3x.png)bin13723 -> 13723 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/images/Ernest_Hemingway@4x.png (renamed from examples/quickcontrols2/chattutorial/shared/Ernest_Hemingway@4x.png)bin24109 -> 24109 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/images/Hans_Gude.png (renamed from examples/quickcontrols2/chattutorial/shared/Hans_Gude.png)bin2937 -> 2937 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/images/Hans_Gude@2x.png (renamed from examples/quickcontrols2/chattutorial/shared/Hans_Gude@2x.png)bin9239 -> 9239 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/images/Hans_Gude@3x.png (renamed from examples/quickcontrols2/chattutorial/shared/Hans_Gude@3x.png)bin18163 -> 18163 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/images/Hans_Gude@4x.png (renamed from examples/quickcontrols2/chattutorial/shared/Hans_Gude@4x.png)bin28614 -> 28614 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/images/images.qrc (renamed from examples/quickcontrols2/chattutorial/shared/shared.qrc)0
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/main.cpp (renamed from examples/quickcontrols2/chattutorial/chapter1-settingup/main.cpp)2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/main.qml (renamed from examples/quickcontrols2/chattutorial/chapter2-lists/main.qml)2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter2/qtquickcontrols2.conf2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3-navigation/CMakeLists.txt79
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3-navigation/chapter3-navigation.pro12
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3-navigation/qml.qrc7
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/CMakeLists.txt60
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/ContactPage.qml (renamed from examples/quickcontrols2/chattutorial/chapter3-navigation/ContactPage.qml)4
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/ConversationPage.qml (renamed from examples/quickcontrols2/chattutorial/chapter3-navigation/ConversationPage.qml)0
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/chapter3.pro29
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein.pngbin0 -> 1669 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein@2x.pngbin0 -> 5657 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein@3x.pngbin0 -> 11804 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein@4x.pngbin0 -> 19989 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway.pngbin0 -> 2255 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway@2x.pngbin0 -> 6375 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway@3x.pngbin0 -> 13723 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway@4x.pngbin0 -> 24109 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude.pngbin0 -> 2937 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude@2x.pngbin0 -> 9239 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude@3x.pngbin0 -> 18163 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude@4x.pngbin0 -> 28614 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/images/images.qrc16
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/main.cpp (renamed from examples/quickcontrols2/chattutorial/chapter2-lists/main.cpp)2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/main.qml (renamed from examples/quickcontrols2/chattutorial/chapter3-navigation/main.qml)0
-rw-r--r--examples/quickcontrols2/chattutorial/chapter3/qtquickcontrols2.conf2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4-models/CMakeLists.txt83
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4-models/chapter4-models.pro18
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4-models/qml.qrc7
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/CMakeLists.txt63
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/ContactPage.qml (renamed from examples/quickcontrols2/chattutorial/chapter4-models/ContactPage.qml)4
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/ConversationPage.qml (renamed from examples/quickcontrols2/chattutorial/chapter4-models/ConversationPage.qml)2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/chapter4.pro34
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein.pngbin0 -> 1669 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein@2x.pngbin0 -> 5657 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein@3x.pngbin0 -> 11804 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein@4x.pngbin0 -> 19989 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway.pngbin0 -> 2255 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway@2x.pngbin0 -> 6375 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway@3x.pngbin0 -> 13723 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway@4x.pngbin0 -> 24109 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude.pngbin0 -> 2937 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude@2x.pngbin0 -> 9239 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude@3x.pngbin0 -> 18163 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude@4x.pngbin0 -> 28614 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/images/images.qrc16
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/main.cpp (renamed from examples/quickcontrols2/chattutorial/chapter4-models/main.cpp)2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/main.qml (renamed from examples/quickcontrols2/chattutorial/chapter4-models/main.qml)0
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/qtquickcontrols2.conf2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/sqlcontactmodel.cpp (renamed from examples/quickcontrols2/chattutorial/chapter4-models/sqlcontactmodel.cpp)0
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/sqlcontactmodel.h (renamed from examples/quickcontrols2/chattutorial/chapter4-models/sqlcontactmodel.h)2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/sqlconversationmodel.cpp (renamed from examples/quickcontrols2/chattutorial/chapter4-models/sqlconversationmodel.cpp)0
-rw-r--r--examples/quickcontrols2/chattutorial/chapter4/sqlconversationmodel.h (renamed from examples/quickcontrols2/chattutorial/chapter4-models/sqlconversationmodel.h)2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/CMakeLists.txt86
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/chapter5-styling.pro18
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5-styling/qml.qrc10
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/+Material/ChatToolBar.qml (renamed from examples/quickcontrols2/chattutorial/chapter5-styling/+Material/ChatToolBar.qml)0
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/CMakeLists.txt65
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/ChatToolBar.qml (renamed from examples/quickcontrols2/chattutorial/chapter5-styling/ChatToolBar.qml)0
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/ContactPage.qml (renamed from examples/quickcontrols2/chattutorial/chapter5-styling/ContactPage.qml)4
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/ConversationPage.qml (renamed from examples/quickcontrols2/chattutorial/chapter5-styling/ConversationPage.qml)2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/chapter5.pro36
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein.pngbin0 -> 1669 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein@2x.pngbin0 -> 5657 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein@3x.pngbin0 -> 11804 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein@4x.pngbin0 -> 19989 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway.pngbin0 -> 2255 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway@2x.pngbin0 -> 6375 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway@3x.pngbin0 -> 13723 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway@4x.pngbin0 -> 24109 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude.pngbin0 -> 2937 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude@2x.pngbin0 -> 9239 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude@3x.pngbin0 -> 18163 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude@4x.pngbin0 -> 28614 bytes
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/images/images.qrc16
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/main.cpp (renamed from examples/quickcontrols2/chattutorial/chapter5-styling/main.cpp)2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/main.qml (renamed from examples/quickcontrols2/chattutorial/chapter5-styling/main.qml)0
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/qtquickcontrols2.conf (renamed from examples/quickcontrols2/chattutorial/chapter5-styling/qtquickcontrols2.conf)5
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/sqlcontactmodel.cpp (renamed from examples/quickcontrols2/chattutorial/chapter5-styling/sqlcontactmodel.cpp)0
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/sqlcontactmodel.h (renamed from examples/quickcontrols2/chattutorial/chapter5-styling/sqlcontactmodel.h)2
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/sqlconversationmodel.cpp (renamed from examples/quickcontrols2/chattutorial/chapter5-styling/sqlconversationmodel.cpp)0
-rw-r--r--examples/quickcontrols2/chattutorial/chapter5/sqlconversationmodel.h (renamed from examples/quickcontrols2/chattutorial/chapter5-styling/sqlconversationmodel.h)2
-rw-r--r--examples/quickcontrols2/chattutorial/chattutorial.pro10
-rw-r--r--examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc46
-rw-r--r--examples/quickcontrols2/flatstyle/flatstyle.qmlproject45
-rw-r--r--examples/quickcontrols2/texteditor/CMakeLists.txt1
-rw-r--r--examples/quickcontrols2/texteditor/documenthandler.cpp69
-rw-r--r--examples/quickcontrols2/texteditor/documenthandler.h16
-rw-r--r--examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml3
-rw-r--r--examples/quickcontrols2/texteditor/qtquickcontrols2.conf11
-rw-r--r--examples/quickcontrols2/texteditor/texteditor.cpp3
-rw-r--r--examples/quickcontrols2/texteditor/texteditor.qrc1
369 files changed, 1849 insertions, 2593 deletions
diff --git a/examples/qml/CMakeLists.txt b/examples/qml/CMakeLists.txt
index 9f32c37621..7f84d6e257 100644
--- a/examples/qml/CMakeLists.txt
+++ b/examples/qml/CMakeLists.txt
@@ -1,6 +1,6 @@
# Generated from qml.pro.
-add_subdirectory(dynamicscene)
+qt_internal_add_example(dynamicscene)
add_subdirectory(referenceexamples)
add_subdirectory(tutorials)
qt_internal_add_example(shell)
diff --git a/examples/qml/doc/src/qml-extending.qdoc b/examples/qml/doc/src/qml-extending.qdoc
index c9922ebd45..36d7ee290c 100644
--- a/examples/qml/doc/src/qml-extending.qdoc
+++ b/examples/qml/doc/src/qml-extending.qdoc
@@ -168,10 +168,12 @@ developed in the previous examples into two types - a \c Boy and a \c Girl.
\snippet referenceexamples/coercion/person.h 0
The Person class remains unaltered in this example and the Boy and Girl C++
-classes are trivial extensions of it. As an example, the inheritance used here
-is a little contrived, but in real applications it is likely that the two
-extensions would add additional properties or modify the Person classes
-behavior.
+classes are trivial extensions of it. The types and their QML name are
+registered with the QML engine.
+
+As an example, the inheritance used here is a little contrived, but in real
+applications it is likely that the two extensions would add additional
+properties or modify the Person classes behavior.
\section2 Define People as a Base Class
@@ -187,15 +189,6 @@ to be registered with the QML engine, so that it can be used as a property type
and other types can be coerced to it. This is what the QML_UNCREATABLE macro
does.
-\section2 Define Boy and Girl
-
-The implementation of Boy and Girl is trivial.
-
-\snippet referenceexamples/coercion/person.cpp 1
-
-All that is necessary is to implement the constructor, and to register the types
-and their QML name with the QML engine.
-
\section1 Running the Example
The BirthdayParty type has not changed since the previous example. The
@@ -271,6 +264,12 @@ This example builds on:
\brief Attached Properties.
\ingroup qmlextendingexamples
+This example demonstrates how to create custom
+\l {Attached Properties and Attached Signal Handlers} {attached properties}.
+For a more in-depth description on how one can create attached properties,
+see \l {Providing Attached Properties}.
+
+
This example builds on:
\list
\li \l {Extending QML - Grouped Properties Example}
diff --git a/examples/qml/referenceexamples/adding/main.cpp b/examples/qml/referenceexamples/adding/main.cpp
index 6c3920f04b..fbf3e71af7 100644
--- a/examples/qml/referenceexamples/adding/main.cpp
+++ b/examples/qml/referenceexamples/adding/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include <QCoreApplication>
#include <QQmlEngine>
#include <QQmlComponent>
@@ -60,12 +61,13 @@ int main(int argc, char ** argv)
QQmlEngine engine;
QQmlComponent component(&engine, QUrl("qrc:example.qml"));
auto *person = qobject_cast<Person *>(component.create());
- if (person) {
- qWarning() << "The person's name is" << person->name();
- qWarning() << "They wear a" << person->shoeSize() << "sized shoe";
- } else {
+ if (!person) {
qWarning() << component.errors();
+ return EXIT_FAILURE;
}
+ qInfo() << "The person's name is" << person->name()
+ << "\nThey wear a" << person->shoeSize() << "sized shoe";
+
return EXIT_SUCCESS;
}
diff --git a/examples/qml/referenceexamples/adding/person.cpp b/examples/qml/referenceexamples/adding/person.cpp
index de4a33dd00..4741442cf0 100644
--- a/examples/qml/referenceexamples/adding/person.cpp
+++ b/examples/qml/referenceexamples/adding/person.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,14 +47,10 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include "person.h"
// ![0]
-Person::Person(QObject *parent)
-: QObject(parent), m_shoeSize(0)
-{
-}
-
QString Person::name() const
{
return m_name;
diff --git a/examples/qml/referenceexamples/adding/person.h b/examples/qml/referenceexamples/adding/person.h
index 530c335dee..03a72d184f 100644
--- a/examples/qml/referenceexamples/adding/person.h
+++ b/examples/qml/referenceexamples/adding/person.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef PERSON_H
#define PERSON_H
@@ -61,7 +62,7 @@ class Person : public QObject
Q_PROPERTY(int shoeSize READ shoeSize WRITE setShoeSize)
QML_ELEMENT
public:
- Person(QObject *parent = nullptr);
+ using QObject::QObject;
QString name() const;
void setName(const QString &);
@@ -71,7 +72,7 @@ public:
private:
QString m_name;
- int m_shoeSize;
+ int m_shoeSize = 0;
};
//![0]
diff --git a/examples/qml/referenceexamples/attached/birthdayparty.cpp b/examples/qml/referenceexamples/attached/birthdayparty.cpp
index 9aed5df621..fc27a22631 100644
--- a/examples/qml/referenceexamples/attached/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/attached/birthdayparty.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "birthdayparty.h"
-BirthdayPartyAttached::BirthdayPartyAttached(QObject *object)
-: QObject(object)
-{
-}
+#include "birthdayparty.h"
QDate BirthdayPartyAttached::rsvp() const
{
@@ -64,11 +60,6 @@ void BirthdayPartyAttached::setRsvp(QDate d)
m_rsvp = d;
}
-BirthdayParty::BirthdayParty(QObject *parent)
-: QObject(parent), m_host(nullptr)
-{
-}
-
Person *BirthdayParty::host() const
{
return m_host;
@@ -84,12 +75,12 @@ QQmlListProperty<Person> BirthdayParty::guests()
return {this, &m_guests};
}
-int BirthdayParty::guestCount() const
+qsizetype BirthdayParty::guestCount() const
{
return m_guests.count();
}
-Person *BirthdayParty::guest(int index) const
+Person *BirthdayParty::guest(qsizetype index) const
{
return m_guests.at(index);
}
diff --git a/examples/qml/referenceexamples/attached/birthdayparty.h b/examples/qml/referenceexamples/attached/birthdayparty.h
index 4f2ed1702a..30f5cbbb64 100644
--- a/examples/qml/referenceexamples/attached/birthdayparty.h
+++ b/examples/qml/referenceexamples/attached/birthdayparty.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef BIRTHDAYPARTY_H
#define BIRTHDAYPARTY_H
@@ -61,7 +62,7 @@ class BirthdayPartyAttached : public QObject
Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp)
QML_ANONYMOUS
public:
- BirthdayPartyAttached(QObject *object);
+ using QObject::QObject;
QDate rsvp() const;
void setRsvp(QDate);
@@ -83,20 +84,20 @@ class BirthdayParty : public QObject
//! [declare attached]
public:
- BirthdayParty(QObject *parent = nullptr);
+ using QObject::QObject;
Person *host() const;
void setHost(Person *);
QQmlListProperty<Person> guests();
- int guestCount() const;
- Person *guest(int) const;
+ qsizetype guestCount() const;
+ Person *guest(qsizetype) const;
//! [static attached]
static BirthdayPartyAttached *qmlAttachedProperties(QObject *);
//! [static attached]
private:
- Person *m_host;
+ Person *m_host = nullptr;
QList<Person *> m_guests;
};
diff --git a/examples/qml/referenceexamples/attached/main.cpp b/examples/qml/referenceexamples/attached/main.cpp
index 2fceb98ac9..5f8497bed3 100644
--- a/examples/qml/referenceexamples/attached/main.cpp
+++ b/examples/qml/referenceexamples/attached/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include <QCoreApplication>
#include <QQmlEngine>
#include <QQmlComponent>
@@ -63,14 +64,14 @@ int main(int argc, char ** argv)
auto *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
- qWarning() << party->host()->name() << "is having a birthday!";
+ qInfo() << party->host()->name() << "is having a birthday!";
if (qobject_cast<Boy *>(party->host()))
- qWarning() << "He is inviting:";
+ qInfo() << "He is inviting:";
else
- qWarning() << "She is inviting:";
+ qInfo() << "She is inviting:";
- for (int ii = 0; ii < party->guestCount(); ++ii) {
+ for (qsizetype ii = 0; ii < party->guestCount(); ++ii) {
Person *guest = party->guest(ii);
//! [query rsvp]
@@ -81,9 +82,9 @@ int main(int argc, char ** argv)
rsvpDate = attached->property("rsvp").toDate();
//! [query rsvp]
if (rsvpDate.isNull())
- qWarning() << " " << guest->name() << "RSVP date: Hasn't RSVP'd";
+ qInfo() << " " << guest->name() << "RSVP date: Hasn't RSVP'd";
else
- qWarning() << " " << guest->name() << "RSVP date:" << qPrintable(rsvpDate.toString());
+ qInfo() << " " << guest->name() << "RSVP date:" << rsvpDate.toString();
}
return EXIT_SUCCESS;
diff --git a/examples/qml/referenceexamples/attached/person.cpp b/examples/qml/referenceexamples/attached/person.cpp
index 0603644108..4e52da76c8 100644
--- a/examples/qml/referenceexamples/attached/person.cpp
+++ b/examples/qml/referenceexamples/attached/person.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "person.h"
-ShoeDescription::ShoeDescription(QObject *parent)
-: QObject(parent), m_size(0), m_price(0)
-{
-}
+#include "person.h"
int ShoeDescription::size() const
{
@@ -94,11 +90,6 @@ void ShoeDescription::setPrice(qreal p)
m_price = p;
}
-Person::Person(QObject *parent)
-: QObject(parent)
-{
-}
-
QString Person::name() const
{
return m_name;
@@ -113,16 +104,3 @@ ShoeDescription *Person::shoe()
{
return &m_shoe;
}
-
-
-Boy::Boy(QObject * parent)
-: Person(parent)
-{
-}
-
-
-Girl::Girl(QObject * parent)
-: Person(parent)
-{
-}
-
diff --git a/examples/qml/referenceexamples/attached/person.h b/examples/qml/referenceexamples/attached/person.h
index 239f4405c0..ddd3baa5f2 100644
--- a/examples/qml/referenceexamples/attached/person.h
+++ b/examples/qml/referenceexamples/attached/person.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef PERSON_H
#define PERSON_H
@@ -63,7 +64,7 @@ class ShoeDescription : public QObject
Q_PROPERTY(qreal price READ price WRITE setPrice)
QML_ANONYMOUS
public:
- ShoeDescription(QObject *parent = 0);
+ using QObject::QObject;
int size() const;
void setSize(int);
@@ -76,11 +77,12 @@ public:
qreal price() const;
void setPrice(qreal);
+
private:
- int m_size;
+ int m_size = 0;
QColor m_color;
QString m_brand;
- qreal m_price;
+ qreal m_price = 0;
};
class Person : public QObject
@@ -90,7 +92,7 @@ class Person : public QObject
Q_PROPERTY(ShoeDescription *shoe READ shoe)
QML_ANONYMOUS
public:
- Person(QObject *parent = nullptr);
+ using QObject::QObject;
QString name() const;
void setName(const QString &);
@@ -106,7 +108,7 @@ class Boy : public Person
Q_OBJECT
QML_ELEMENT
public:
- Boy(QObject * parent = nullptr);
+ using Person::Person;
};
class Girl : public Person
@@ -114,7 +116,7 @@ class Girl : public Person
Q_OBJECT
QML_ELEMENT
public:
- Girl(QObject * parent = nullptr);
+ using Person::Person;
};
#endif // PERSON_H
diff --git a/examples/qml/referenceexamples/binding/birthdayparty.cpp b/examples/qml/referenceexamples/binding/birthdayparty.cpp
index 02a1adbb35..ce86c7faa4 100644
--- a/examples/qml/referenceexamples/binding/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/binding/birthdayparty.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "birthdayparty.h"
-BirthdayPartyAttached::BirthdayPartyAttached(QObject *object)
-: QObject(object)
-{
-}
+#include "birthdayparty.h"
QDate BirthdayPartyAttached::rsvp() const
{
@@ -67,12 +63,6 @@ void BirthdayPartyAttached::setRsvp(QDate d)
}
}
-
-BirthdayParty::BirthdayParty(QObject *parent)
-: QObject(parent), m_host(nullptr)
-{
-}
-
Person *BirthdayParty::host() const
{
return m_host;
@@ -90,12 +80,12 @@ QQmlListProperty<Person> BirthdayParty::guests()
return QQmlListProperty<Person>(this, &m_guests);
}
-int BirthdayParty::guestCount() const
+qsizetype BirthdayParty::guestCount() const
{
return m_guests.count();
}
-Person *BirthdayParty::guest(int index) const
+Person *BirthdayParty::guest(qsizetype index) const
{
return m_guests.at(index);
}
@@ -113,7 +103,7 @@ QString BirthdayParty::announcement() const
void BirthdayParty::setAnnouncement(const QString &speak)
{
- qWarning() << qPrintable(speak);
+ qWarning().noquote() << speak;
}
BirthdayPartyAttached *BirthdayParty::qmlAttachedProperties(QObject *object)
diff --git a/examples/qml/referenceexamples/binding/birthdayparty.h b/examples/qml/referenceexamples/binding/birthdayparty.h
index 846a016cfc..2881dfead2 100644
--- a/examples/qml/referenceexamples/binding/birthdayparty.h
+++ b/examples/qml/referenceexamples/binding/birthdayparty.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef BIRTHDAYPARTY_H
#define BIRTHDAYPARTY_H
@@ -62,7 +63,7 @@ class BirthdayPartyAttached : public QObject
Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp NOTIFY rsvpChanged)
QML_ANONYMOUS
public:
- BirthdayPartyAttached(QObject *object);
+ using QObject::QObject;
QDate rsvp() const;
void setRsvp(QDate);
@@ -86,14 +87,14 @@ class BirthdayParty : public QObject
QML_ELEMENT
QML_ATTACHED(BirthdayPartyAttached)
public:
- BirthdayParty(QObject *parent = nullptr);
+ using QObject::QObject;
Person *host() const;
void setHost(Person *);
QQmlListProperty<Person> guests();
- int guestCount() const;
- Person *guest(int) const;
+ qsizetype guestCount() const;
+ Person *guest(qsizetype) const;
QString announcement() const;
void setAnnouncement(const QString &);
@@ -106,7 +107,7 @@ signals:
void hostChanged();
private:
- Person *m_host;
+ Person *m_host = nullptr;
QList<Person *> m_guests;
};
diff --git a/examples/qml/referenceexamples/binding/happybirthdaysong.cpp b/examples/qml/referenceexamples/binding/happybirthdaysong.cpp
index 5f8e6d696e..2722b65e06 100644
--- a/examples/qml/referenceexamples/binding/happybirthdaysong.cpp
+++ b/examples/qml/referenceexamples/binding/happybirthdaysong.cpp
@@ -50,10 +50,9 @@
#include "happybirthdaysong.h"
#include <QTimer>
-HappyBirthdaySong::HappyBirthdaySong(QObject *parent)
-: QObject(parent), m_line(-1)
+HappyBirthdaySong::HappyBirthdaySong(QObject *parent) :
+ QObject(parent)
{
- setName(QString());
auto *timer = new QTimer(this);
QObject::connect(timer, &QTimer::timeout, this, &HappyBirthdaySong::advance);
timer->start(1000);
diff --git a/examples/qml/referenceexamples/binding/happybirthdaysong.h b/examples/qml/referenceexamples/binding/happybirthdaysong.h
index c84e9d9e5e..078bdac72b 100644
--- a/examples/qml/referenceexamples/binding/happybirthdaysong.h
+++ b/examples/qml/referenceexamples/binding/happybirthdaysong.h
@@ -64,7 +64,7 @@ class HappyBirthdaySong : public QObject, public QQmlPropertyValueSource
Q_INTERFACES(QQmlPropertyValueSource)
QML_ELEMENT
public:
- HappyBirthdaySong(QObject *parent = nullptr);
+ explicit HappyBirthdaySong(QObject *parent = nullptr);
void setTarget(const QQmlProperty &) override;
@@ -77,7 +77,7 @@ private slots:
signals:
void nameChanged();
private:
- int m_line;
+ qsizetype m_line = -1;
QStringList m_lyrics;
QQmlProperty m_target;
QString m_name;
diff --git a/examples/qml/referenceexamples/binding/main.cpp b/examples/qml/referenceexamples/binding/main.cpp
index 2e9995fcd8..a100497659 100644
--- a/examples/qml/referenceexamples/binding/main.cpp
+++ b/examples/qml/referenceexamples/binding/main.cpp
@@ -64,14 +64,14 @@ int main(int argc, char ** argv)
auto *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
- qWarning() << party->host()->name() << "is having a birthday!";
+ qInfo() << party->host()->name() << "is having a birthday!";
if (qobject_cast<Boy *>(party->host()))
- qWarning() << "He is inviting:";
+ qInfo() << "He is inviting:";
else
- qWarning() << "She is inviting:";
+ qInfo() << "She is inviting:";
- for (int ii = 0; ii < party->guestCount(); ++ii) {
+ for (qsizetype ii = 0; ii < party->guestCount(); ++ii) {
Person *guest = party->guest(ii);
QDate rsvpDate;
@@ -81,9 +81,9 @@ int main(int argc, char ** argv)
rsvpDate = attached->property("rsvp").toDate();
if (rsvpDate.isNull())
- qWarning() << " " << guest->name() << "RSVP date: Hasn't RSVP'd";
+ qInfo() << " " << guest->name() << "RSVP date: Hasn't RSVP'd";
else
- qWarning() << " " << guest->name() << "RSVP date:" << qPrintable(rsvpDate.toString());
+ qInfo() << " " << guest->name() << "RSVP date:" << rsvpDate.toString();
}
party->startParty();
diff --git a/examples/qml/referenceexamples/binding/person.cpp b/examples/qml/referenceexamples/binding/person.cpp
index 1a23d0a4f5..0296b0a7c6 100644
--- a/examples/qml/referenceexamples/binding/person.cpp
+++ b/examples/qml/referenceexamples/binding/person.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "person.h"
-ShoeDescription::ShoeDescription(QObject *parent)
-: QObject(parent), m_size(0), m_price(0)
-{
-}
+#include "person.h"
int ShoeDescription::size() const
{
@@ -110,11 +106,6 @@ void ShoeDescription::setPrice(qreal p)
emit shoeChanged();
}
-Person::Person(QObject *parent)
-: QObject(parent)
-{
-}
-
QString Person::name() const
{
return m_name;
@@ -133,16 +124,3 @@ ShoeDescription *Person::shoe()
{
return &m_shoe;
}
-
-
-Boy::Boy(QObject * parent)
-: Person(parent)
-{
-}
-
-
-Girl::Girl(QObject * parent)
-: Person(parent)
-{
-}
-
diff --git a/examples/qml/referenceexamples/binding/person.h b/examples/qml/referenceexamples/binding/person.h
index af9864950a..e84075bb36 100644
--- a/examples/qml/referenceexamples/binding/person.h
+++ b/examples/qml/referenceexamples/binding/person.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef PERSON_H
#define PERSON_H
@@ -63,7 +64,7 @@ class ShoeDescription : public QObject
Q_PROPERTY(qreal price READ price WRITE setPrice NOTIFY shoeChanged)
QML_ANONYMOUS
public:
- ShoeDescription(QObject *parent = nullptr);
+ using QObject::QObject;
int size() const;
void setSize(int);
@@ -76,14 +77,15 @@ public:
qreal price() const;
void setPrice(qreal);
+
signals:
void shoeChanged();
private:
- int m_size;
+ int m_size = 0;
QColor m_color;
QString m_brand;
- qreal m_price;
+ qreal m_price = 0;
};
class Person : public QObject
@@ -95,12 +97,13 @@ class Person : public QObject
// ![0]
QML_ANONYMOUS
public:
- Person(QObject *parent = nullptr);
+ using QObject::QObject;
QString name() const;
void setName(const QString &);
ShoeDescription *shoe();
+
signals:
void nameChanged();
@@ -114,7 +117,7 @@ class Boy : public Person
Q_OBJECT
QML_ELEMENT
public:
- Boy(QObject * parent = nullptr);
+ using Person::Person;
};
class Girl : public Person
@@ -122,7 +125,7 @@ class Girl : public Person
Q_OBJECT
QML_ELEMENT
public:
- Girl(QObject * parent = nullptr);
+ using Person::Person;
};
#endif // PERSON_H
diff --git a/examples/qml/referenceexamples/coercion/birthdayparty.cpp b/examples/qml/referenceexamples/coercion/birthdayparty.cpp
index 81db8ab1b8..269f45e02c 100644
--- a/examples/qml/referenceexamples/coercion/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/coercion/birthdayparty.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "birthdayparty.h"
-BirthdayParty::BirthdayParty(QObject *parent)
-: QObject(parent), m_host(nullptr)
-{
-}
+#include "birthdayparty.h"
Person *BirthdayParty::host() const
{
@@ -69,13 +65,12 @@ QQmlListProperty<Person> BirthdayParty::guests()
return {this, &m_guests};
}
-int BirthdayParty::guestCount() const
+qsizetype BirthdayParty::guestCount() const
{
return m_guests.count();
}
-Person *BirthdayParty::guest(int index) const
+Person *BirthdayParty::guest(qsizetype index) const
{
return m_guests.at(index);
}
-
diff --git a/examples/qml/referenceexamples/coercion/birthdayparty.h b/examples/qml/referenceexamples/coercion/birthdayparty.h
index ba8b2445f1..a504479e4d 100644
--- a/examples/qml/referenceexamples/coercion/birthdayparty.h
+++ b/examples/qml/referenceexamples/coercion/birthdayparty.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef BIRTHDAYPARTY_H
#define BIRTHDAYPARTY_H
@@ -63,17 +64,17 @@ class BirthdayParty : public QObject
QML_ELEMENT
// ![0]
public:
- BirthdayParty(QObject *parent = nullptr);
+ using QObject::QObject;
Person *host() const;
void setHost(Person *);
QQmlListProperty<Person> guests();
- int guestCount() const;
- Person *guest(int) const;
+ qsizetype guestCount() const;
+ Person *guest(qsizetype) const;
private:
- Person *m_host;
+ Person *m_host = nullptr;
QList<Person *> m_guests;
};
diff --git a/examples/qml/referenceexamples/coercion/main.cpp b/examples/qml/referenceexamples/coercion/main.cpp
index 6b47d0d4c4..095602af9d 100644
--- a/examples/qml/referenceexamples/coercion/main.cpp
+++ b/examples/qml/referenceexamples/coercion/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include <QCoreApplication>
#include <QQmlEngine>
#include <QQmlComponent>
@@ -63,15 +64,15 @@ int main(int argc, char ** argv)
auto *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
- qWarning() << party->host()->name() << "is having a birthday!";
+ qInfo() << party->host()->name() << "is having a birthday!";
if (qobject_cast<Boy *>(party->host()))
- qWarning() << "He is inviting:";
+ qInfo() << "He is inviting:";
else
- qWarning() << "She is inviting:";
+ qInfo() << "She is inviting:";
- for (int ii = 0; ii < party->guestCount(); ++ii)
- qWarning() << " " << party->guest(ii)->name();
+ for (qsizetype ii = 0; ii < party->guestCount(); ++ii)
+ qInfo() << " " << party->guest(ii)->name();
return EXIT_SUCCESS;
}
diff --git a/examples/qml/referenceexamples/coercion/person.cpp b/examples/qml/referenceexamples/coercion/person.cpp
index 178d7052ce..e2847a2682 100644
--- a/examples/qml/referenceexamples/coercion/person.cpp
+++ b/examples/qml/referenceexamples/coercion/person.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "person.h"
-Person::Person(QObject *parent)
-: QObject(parent), m_shoeSize(0)
-{
-}
+#include "person.h"
QString Person::name() const
{
@@ -73,17 +69,3 @@ void Person::setShoeSize(int s)
{
m_shoeSize = s;
}
-
-// ![1]
-Boy::Boy(QObject * parent)
-: Person(parent)
-{
-}
-
-
-Girl::Girl(QObject * parent)
-: Person(parent)
-{
-}
-
-// ![1]
diff --git a/examples/qml/referenceexamples/coercion/person.h b/examples/qml/referenceexamples/coercion/person.h
index 7e2828da04..1ec095e841 100644
--- a/examples/qml/referenceexamples/coercion/person.h
+++ b/examples/qml/referenceexamples/coercion/person.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef PERSON_H
#define PERSON_H
@@ -63,16 +64,17 @@ class Person : public QObject
QML_UNCREATABLE("Person is an abstract base class.")
//![0]
public:
- Person(QObject *parent = nullptr);
+ using QObject::QObject;
QString name() const;
void setName(const QString &);
int shoeSize() const;
void setShoeSize(int);
+
private:
QString m_name;
- int m_shoeSize;
+ int m_shoeSize = 0;
};
@@ -82,7 +84,7 @@ class Boy : public Person
Q_OBJECT
QML_ELEMENT
public:
- Boy(QObject * parent = nullptr);
+ using Person::Person;
};
//! [girl class]
@@ -91,7 +93,7 @@ class Girl : public Person
Q_OBJECT
QML_ELEMENT
public:
- Girl(QObject * parent = nullptr);
+ using Person::Person;
};
//! [girl class]
diff --git a/examples/qml/referenceexamples/default/birthdayparty.cpp b/examples/qml/referenceexamples/default/birthdayparty.cpp
index 81db8ab1b8..aeaf6fbd9c 100644
--- a/examples/qml/referenceexamples/default/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/default/birthdayparty.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "birthdayparty.h"
-BirthdayParty::BirthdayParty(QObject *parent)
-: QObject(parent), m_host(nullptr)
-{
-}
+#include "birthdayparty.h"
Person *BirthdayParty::host() const
{
@@ -69,12 +65,12 @@ QQmlListProperty<Person> BirthdayParty::guests()
return {this, &m_guests};
}
-int BirthdayParty::guestCount() const
+qsizetype BirthdayParty::guestCount() const
{
return m_guests.count();
}
-Person *BirthdayParty::guest(int index) const
+Person *BirthdayParty::guest(qsizetype index) const
{
return m_guests.at(index);
}
diff --git a/examples/qml/referenceexamples/default/birthdayparty.h b/examples/qml/referenceexamples/default/birthdayparty.h
index 5eb6c88763..cb12a1510b 100644
--- a/examples/qml/referenceexamples/default/birthdayparty.h
+++ b/examples/qml/referenceexamples/default/birthdayparty.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef BIRTHDAYPARTY_H
#define BIRTHDAYPARTY_H
@@ -63,17 +64,17 @@ class BirthdayParty : public QObject
Q_CLASSINFO("DefaultProperty", "guests")
QML_ELEMENT
public:
- BirthdayParty(QObject *parent = nullptr);
+ using QObject::QObject;
Person *host() const;
void setHost(Person *);
QQmlListProperty<Person> guests();
- int guestCount() const;
- Person *guest(int) const;
+ qsizetype guestCount() const;
+ Person *guest(qsizetype) const;
private:
- Person *m_host;
+ Person *m_host = nullptr;
QList<Person *> m_guests;
};
// ![0]
diff --git a/examples/qml/referenceexamples/default/main.cpp b/examples/qml/referenceexamples/default/main.cpp
index 6b47d0d4c4..82e6f5ba37 100644
--- a/examples/qml/referenceexamples/default/main.cpp
+++ b/examples/qml/referenceexamples/default/main.cpp
@@ -63,15 +63,15 @@ int main(int argc, char ** argv)
auto *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
- qWarning() << party->host()->name() << "is having a birthday!";
+ qInfo() << party->host()->name() << "is having a birthday!";
if (qobject_cast<Boy *>(party->host()))
- qWarning() << "He is inviting:";
+ qInfo() << "He is inviting:";
else
- qWarning() << "She is inviting:";
+ qInfo() << "She is inviting:";
- for (int ii = 0; ii < party->guestCount(); ++ii)
- qWarning() << " " << party->guest(ii)->name();
+ for (qsizetype ii = 0; ii < party->guestCount(); ++ii)
+ qInfo() << " " << party->guest(ii)->name();
return EXIT_SUCCESS;
}
diff --git a/examples/qml/referenceexamples/default/person.cpp b/examples/qml/referenceexamples/default/person.cpp
index a1d887a4d0..e2847a2682 100644
--- a/examples/qml/referenceexamples/default/person.cpp
+++ b/examples/qml/referenceexamples/default/person.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "person.h"
-Person::Person(QObject *parent)
-: QObject(parent), m_shoeSize(0)
-{
-}
+#include "person.h"
QString Person::name() const
{
@@ -73,16 +69,3 @@ void Person::setShoeSize(int s)
{
m_shoeSize = s;
}
-
-
-Boy::Boy(QObject * parent)
-: Person(parent)
-{
-}
-
-
-Girl::Girl(QObject * parent)
-: Person(parent)
-{
-}
-
diff --git a/examples/qml/referenceexamples/default/person.h b/examples/qml/referenceexamples/default/person.h
index 361a89c599..0b2e280747 100644
--- a/examples/qml/referenceexamples/default/person.h
+++ b/examples/qml/referenceexamples/default/person.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef PERSON_H
#define PERSON_H
@@ -60,7 +61,7 @@ class Person : public QObject
Q_PROPERTY(int shoeSize READ shoeSize WRITE setShoeSize)
QML_ANONYMOUS
public:
- Person(QObject *parent = nullptr);
+ using QObject::QObject;
QString name() const;
void setName(const QString &);
@@ -69,7 +70,7 @@ public:
void setShoeSize(int);
private:
QString m_name;
- int m_shoeSize;
+ int m_shoeSize = 0;
};
class Boy : public Person
@@ -77,7 +78,7 @@ class Boy : public Person
Q_OBJECT
QML_ELEMENT
public:
- Boy(QObject * parent = nullptr);
+ using Person::Person;
};
class Girl : public Person
@@ -85,7 +86,7 @@ class Girl : public Person
Q_OBJECT
QML_ELEMENT
public:
- Girl(QObject * parent = nullptr);
+ using Person::Person;
};
#endif // PERSON_H
diff --git a/examples/qml/referenceexamples/grouped/birthdayparty.cpp b/examples/qml/referenceexamples/grouped/birthdayparty.cpp
index 81db8ab1b8..269f45e02c 100644
--- a/examples/qml/referenceexamples/grouped/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/grouped/birthdayparty.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "birthdayparty.h"
-BirthdayParty::BirthdayParty(QObject *parent)
-: QObject(parent), m_host(nullptr)
-{
-}
+#include "birthdayparty.h"
Person *BirthdayParty::host() const
{
@@ -69,13 +65,12 @@ QQmlListProperty<Person> BirthdayParty::guests()
return {this, &m_guests};
}
-int BirthdayParty::guestCount() const
+qsizetype BirthdayParty::guestCount() const
{
return m_guests.count();
}
-Person *BirthdayParty::guest(int index) const
+Person *BirthdayParty::guest(qsizetype index) const
{
return m_guests.at(index);
}
-
diff --git a/examples/qml/referenceexamples/grouped/birthdayparty.h b/examples/qml/referenceexamples/grouped/birthdayparty.h
index f6834dad89..a8e0964365 100644
--- a/examples/qml/referenceexamples/grouped/birthdayparty.h
+++ b/examples/qml/referenceexamples/grouped/birthdayparty.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef BIRTHDAYPARTY_H
#define BIRTHDAYPARTY_H
@@ -62,14 +63,14 @@ class BirthdayParty : public QObject
Q_CLASSINFO("DefaultProperty", "guests")
QML_ELEMENT
public:
- BirthdayParty(QObject *parent = nullptr);
+ using QObject::QObject;
Person *host() const;
void setHost(Person *);
QQmlListProperty<Person> guests();
- int guestCount() const;
- Person *guest(int) const;
+ qsizetype guestCount() const;
+ Person *guest(qsizetype) const;
private:
Person *m_host;
diff --git a/examples/qml/referenceexamples/grouped/main.cpp b/examples/qml/referenceexamples/grouped/main.cpp
index 63dbe988a4..6d4ec517cc 100644
--- a/examples/qml/referenceexamples/grouped/main.cpp
+++ b/examples/qml/referenceexamples/grouped/main.cpp
@@ -63,23 +63,23 @@ int main(int argc, char ** argv)
auto *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
- qWarning() << party->host()->name() << "is having a birthday!";
+ qInfo() << party->host()->name() << "is having a birthday!";
if (qobject_cast<Boy *>(party->host()))
- qWarning() << "He is inviting:";
+ qInfo() << "He is inviting:";
else
- qWarning() << "She is inviting:";
+ qInfo() << "She is inviting:";
Person *bestShoe = nullptr;
- for (int ii = 0; ii < party->guestCount(); ++ii) {
+ for (qsizetype ii = 0; ii < party->guestCount(); ++ii) {
Person *guest = party->guest(ii);
- qWarning() << " " << guest->name();
+ qInfo() << " " << guest->name();
if (!bestShoe || bestShoe->shoe()->price() < guest->shoe()->price())
bestShoe = guest;
}
if (bestShoe)
- qWarning() << bestShoe->name() << "is wearing the best shoes!";
+ qInfo() << bestShoe->name() << "is wearing the best shoes!";
return EXIT_SUCCESS;
}
diff --git a/examples/qml/referenceexamples/grouped/person.cpp b/examples/qml/referenceexamples/grouped/person.cpp
index 0603644108..4e52da76c8 100644
--- a/examples/qml/referenceexamples/grouped/person.cpp
+++ b/examples/qml/referenceexamples/grouped/person.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "person.h"
-ShoeDescription::ShoeDescription(QObject *parent)
-: QObject(parent), m_size(0), m_price(0)
-{
-}
+#include "person.h"
int ShoeDescription::size() const
{
@@ -94,11 +90,6 @@ void ShoeDescription::setPrice(qreal p)
m_price = p;
}
-Person::Person(QObject *parent)
-: QObject(parent)
-{
-}
-
QString Person::name() const
{
return m_name;
@@ -113,16 +104,3 @@ ShoeDescription *Person::shoe()
{
return &m_shoe;
}
-
-
-Boy::Boy(QObject * parent)
-: Person(parent)
-{
-}
-
-
-Girl::Girl(QObject * parent)
-: Person(parent)
-{
-}
-
diff --git a/examples/qml/referenceexamples/grouped/person.h b/examples/qml/referenceexamples/grouped/person.h
index df507c7386..ed77f8c4d8 100644
--- a/examples/qml/referenceexamples/grouped/person.h
+++ b/examples/qml/referenceexamples/grouped/person.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef PERSON_H
#define PERSON_H
@@ -63,7 +64,7 @@ class ShoeDescription : public QObject
Q_PROPERTY(qreal price READ price WRITE setPrice)
QML_ANONYMOUS
public:
- ShoeDescription(QObject *parent = nullptr);
+ using QObject::QObject;
int size() const;
void setSize(int);
@@ -76,11 +77,12 @@ public:
qreal price() const;
void setPrice(qreal);
+
private:
- int m_size;
+ int m_size = 0;
QColor m_color;
QString m_brand;
- qreal m_price;
+ qreal m_price = 0;
};
class Person : public QObject
@@ -92,7 +94,7 @@ class Person : public QObject
// ![1]
QML_ANONYMOUS
public:
- Person(QObject *parent = nullptr);
+ using QObject::QObject;
QString name() const;
void setName(const QString &);
@@ -108,7 +110,7 @@ class Boy : public Person
Q_OBJECT
QML_ELEMENT
public:
- Boy(QObject * parent = nullptr);
+ using Person::Person;
};
class Girl : public Person
@@ -116,7 +118,7 @@ class Girl : public Person
Q_OBJECT
QML_ELEMENT
public:
- Girl(QObject * parent = nullptr);
+ using Person::Person;
};
#endif // PERSON_H
diff --git a/examples/qml/referenceexamples/methods/birthdayparty.cpp b/examples/qml/referenceexamples/methods/birthdayparty.cpp
index 4b30d31aeb..1308a09b72 100644
--- a/examples/qml/referenceexamples/methods/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/methods/birthdayparty.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "birthdayparty.h"
-BirthdayParty::BirthdayParty(QObject *parent)
-: QObject(parent), m_host(nullptr)
-{
-}
+#include "birthdayparty.h"
// ![0]
Person *BirthdayParty::host() const
@@ -70,12 +66,12 @@ QQmlListProperty<Person> BirthdayParty::guests()
return {this, &m_guests};
}
-int BirthdayParty::guestCount() const
+qsizetype BirthdayParty::guestCount() const
{
return m_guests.count();
}
-Person *BirthdayParty::guest(int index) const
+Person *BirthdayParty::guest(qsizetype index) const
{
return m_guests.at(index);
}
diff --git a/examples/qml/referenceexamples/methods/birthdayparty.h b/examples/qml/referenceexamples/methods/birthdayparty.h
index 5c2f3c9def..b43308ac8f 100644
--- a/examples/qml/referenceexamples/methods/birthdayparty.h
+++ b/examples/qml/referenceexamples/methods/birthdayparty.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef BIRTHDAYPARTY_H
#define BIRTHDAYPARTY_H
@@ -61,21 +62,21 @@ class BirthdayParty : public QObject
Q_PROPERTY(QQmlListProperty<Person> guests READ guests)
QML_ELEMENT
public:
- BirthdayParty(QObject *parent = nullptr);
+ using QObject::QObject;
Person *host() const;
void setHost(Person *);
QQmlListProperty<Person> guests();
- int guestCount() const;
- Person *guest(int) const;
+ qsizetype guestCount() const;
+ Person *guest(qsizetype) const;
// ![0]
Q_INVOKABLE void invite(const QString &name);
// ![0]
private:
- Person *m_host;
+ Person *m_host = nullptr;
QList<Person *> m_guests;
};
diff --git a/examples/qml/referenceexamples/methods/main.cpp b/examples/qml/referenceexamples/methods/main.cpp
index e30e1d9fb1..32eb4831cc 100644
--- a/examples/qml/referenceexamples/methods/main.cpp
+++ b/examples/qml/referenceexamples/methods/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include <QCoreApplication>
#include <QQmlEngine>
#include <QQmlComponent>
@@ -63,10 +64,10 @@ int main(int argc, char ** argv)
auto *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
- qWarning() << party->host()->name() << "is having a birthday!";
- qWarning() << "They are inviting:";
- for (int ii = 0; ii < party->guestCount(); ++ii)
- qWarning() << " " << party->guest(ii)->name();
+ qInfo() << party->host()->name() << "is having a birthday!"
+ << "\nThey are inviting:";
+ for (qsizetype ii = 0; ii < party->guestCount(); ++ii)
+ qInfo() << " " << party->guest(ii)->name();
return EXIT_SUCCESS;
}
diff --git a/examples/qml/referenceexamples/methods/person.cpp b/examples/qml/referenceexamples/methods/person.cpp
index 7712363ebf..e2847a2682 100644
--- a/examples/qml/referenceexamples/methods/person.cpp
+++ b/examples/qml/referenceexamples/methods/person.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "person.h"
-Person::Person(QObject *parent)
-: QObject(parent), m_shoeSize(0)
-{
-}
+#include "person.h"
QString Person::name() const
{
@@ -73,4 +69,3 @@ void Person::setShoeSize(int s)
{
m_shoeSize = s;
}
-
diff --git a/examples/qml/referenceexamples/methods/person.h b/examples/qml/referenceexamples/methods/person.h
index 2407fbb1b9..0849d1ee8c 100644
--- a/examples/qml/referenceexamples/methods/person.h
+++ b/examples/qml/referenceexamples/methods/person.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef PERSON_H
#define PERSON_H
@@ -60,16 +61,17 @@ class Person : public QObject
Q_PROPERTY(int shoeSize READ shoeSize WRITE setShoeSize)
QML_ELEMENT
public:
- Person(QObject *parent = nullptr);
+ using QObject::QObject;
QString name() const;
void setName(const QString &);
int shoeSize() const;
void setShoeSize(int);
+
private:
QString m_name;
- int m_shoeSize;
+ int m_shoeSize = 0;
};
#endif // PERSON_H
diff --git a/examples/qml/referenceexamples/properties/birthdayparty.cpp b/examples/qml/referenceexamples/properties/birthdayparty.cpp
index 2dc9bd803d..aca626db74 100644
--- a/examples/qml/referenceexamples/properties/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/properties/birthdayparty.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "birthdayparty.h"
-BirthdayParty::BirthdayParty(QObject *parent)
-: QObject(parent), m_host(nullptr)
-{
-}
+#include "birthdayparty.h"
// ![0]
Person *BirthdayParty::host() const
@@ -76,11 +72,11 @@ QQmlListProperty<Person> BirthdayParty::guests()
&BirthdayParty::removeLastGuest};
}
-void BirthdayParty::appendGuest(Person* p) {
+void BirthdayParty::appendGuest(Person *p)
+{
m_guests.append(p);
}
-
qsizetype BirthdayParty::guestCount() const
{
return m_guests.count();
@@ -107,12 +103,14 @@ void BirthdayParty::removeLastGuest()
// ![0]
-void BirthdayParty::appendGuest(QQmlListProperty<Person>* list, Person* p) {
- reinterpret_cast< BirthdayParty* >(list->data)->appendGuest(p);
+void BirthdayParty::appendGuest(QQmlListProperty<Person> *list, Person *p)
+{
+ reinterpret_cast< BirthdayParty *>(list->data)->appendGuest(p);
}
-void BirthdayParty::clearGuests(QQmlListProperty<Person>* list) {
- reinterpret_cast< BirthdayParty* >(list->data)->clearGuests();
+void BirthdayParty::clearGuests(QQmlListProperty<Person>* list)
+{
+ reinterpret_cast< BirthdayParty *>(list->data)->clearGuests();
}
void BirthdayParty::replaceGuest(QQmlListProperty<Person> *list, qsizetype i, Person *p)
@@ -125,10 +123,12 @@ void BirthdayParty::removeLastGuest(QQmlListProperty<Person> *list)
reinterpret_cast< BirthdayParty* >(list->data)->removeLastGuest();
}
-Person* BirthdayParty::guest(QQmlListProperty<Person>* list, qsizetype i) {
+Person* BirthdayParty::guest(QQmlListProperty<Person> *list, qsizetype i)
+{
return reinterpret_cast< BirthdayParty* >(list->data)->guest(i);
}
-qsizetype BirthdayParty::guestCount(QQmlListProperty<Person>* list) {
+qsizetype BirthdayParty::guestCount(QQmlListProperty<Person> *list)
+{
return reinterpret_cast< BirthdayParty* >(list->data)->guestCount();
}
diff --git a/examples/qml/referenceexamples/properties/birthdayparty.h b/examples/qml/referenceexamples/properties/birthdayparty.h
index 7e1668add3..278c011d11 100644
--- a/examples/qml/referenceexamples/properties/birthdayparty.h
+++ b/examples/qml/referenceexamples/properties/birthdayparty.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef BIRTHDAYPARTY_H
#define BIRTHDAYPARTY_H
@@ -69,28 +70,28 @@ class BirthdayParty : public QObject
// ![3]
QML_ELEMENT
public:
- BirthdayParty(QObject *parent = nullptr);
+ using QObject::QObject;
Person *host() const;
void setHost(Person *);
QQmlListProperty<Person> guests();
- void appendGuest(Person*);
+ void appendGuest(Person *);
qsizetype guestCount() const;
Person *guest(qsizetype) const;
void clearGuests();
- void replaceGuest(qsizetype, Person*);
+ void replaceGuest(qsizetype, Person *);
void removeLastGuest();
private:
- static void appendGuest(QQmlListProperty<Person>*, Person*);
- static qsizetype guestCount(QQmlListProperty<Person>*);
- static Person* guest(QQmlListProperty<Person>*, qsizetype);
- static void clearGuests(QQmlListProperty<Person>*);
- static void replaceGuest(QQmlListProperty<Person>*, qsizetype, Person*);
- static void removeLastGuest(QQmlListProperty<Person>*);
+ static void appendGuest(QQmlListProperty<Person> *, Person *);
+ static qsizetype guestCount(QQmlListProperty<Person> *);
+ static Person* guest(QQmlListProperty<Person> *, qsizetype);
+ static void clearGuests(QQmlListProperty<Person> *);
+ static void replaceGuest(QQmlListProperty<Person> *, qsizetype, Person *);
+ static void removeLastGuest(QQmlListProperty<Person> *);
- Person *m_host;
+ Person *m_host = nullptr;
QList<Person *> m_guests;
};
// ![3]
diff --git a/examples/qml/referenceexamples/properties/main.cpp b/examples/qml/referenceexamples/properties/main.cpp
index e30e1d9fb1..cd71497002 100644
--- a/examples/qml/referenceexamples/properties/main.cpp
+++ b/examples/qml/referenceexamples/properties/main.cpp
@@ -63,10 +63,10 @@ int main(int argc, char ** argv)
auto *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
- qWarning() << party->host()->name() << "is having a birthday!";
- qWarning() << "They are inviting:";
- for (int ii = 0; ii < party->guestCount(); ++ii)
- qWarning() << " " << party->guest(ii)->name();
+ qInfo() << party->host()->name() << "is having a birthday!\n"
+ "They are inviting:";
+ for (qsizetype ii = 0; ii < party->guestCount(); ++ii)
+ qInfo() << " " << party->guest(ii)->name();
return EXIT_SUCCESS;
}
diff --git a/examples/qml/referenceexamples/properties/person.cpp b/examples/qml/referenceexamples/properties/person.cpp
index 7712363ebf..e2847a2682 100644
--- a/examples/qml/referenceexamples/properties/person.cpp
+++ b/examples/qml/referenceexamples/properties/person.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "person.h"
-Person::Person(QObject *parent)
-: QObject(parent), m_shoeSize(0)
-{
-}
+#include "person.h"
QString Person::name() const
{
@@ -73,4 +69,3 @@ void Person::setShoeSize(int s)
{
m_shoeSize = s;
}
-
diff --git a/examples/qml/referenceexamples/properties/person.h b/examples/qml/referenceexamples/properties/person.h
index 2407fbb1b9..0849d1ee8c 100644
--- a/examples/qml/referenceexamples/properties/person.h
+++ b/examples/qml/referenceexamples/properties/person.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef PERSON_H
#define PERSON_H
@@ -60,16 +61,17 @@ class Person : public QObject
Q_PROPERTY(int shoeSize READ shoeSize WRITE setShoeSize)
QML_ELEMENT
public:
- Person(QObject *parent = nullptr);
+ using QObject::QObject;
QString name() const;
void setName(const QString &);
int shoeSize() const;
void setShoeSize(int);
+
private:
QString m_name;
- int m_shoeSize;
+ int m_shoeSize = 0;
};
#endif // PERSON_H
diff --git a/examples/qml/referenceexamples/signal/birthdayparty.cpp b/examples/qml/referenceexamples/signal/birthdayparty.cpp
index 215c09782a..27498c9cc9 100644
--- a/examples/qml/referenceexamples/signal/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/signal/birthdayparty.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,16 +47,12 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "birthdayparty.h"
-BirthdayPartyAttached::BirthdayPartyAttached(QObject *object)
-: QObject(object)
-{
-}
+#include "birthdayparty.h"
QDate BirthdayPartyAttached::rsvp() const
{
- return m_rsvp;
+ return m_rsvp;
}
void BirthdayPartyAttached::setRsvp(QDate d)
@@ -64,12 +60,6 @@ void BirthdayPartyAttached::setRsvp(QDate d)
m_rsvp = d;
}
-
-BirthdayParty::BirthdayParty(QObject *parent)
-: QObject(parent), m_host(nullptr)
-{
-}
-
Person *BirthdayParty::host() const
{
return m_host;
@@ -85,12 +75,12 @@ QQmlListProperty<Person> BirthdayParty::guests()
return {this, &m_guests};
}
-int BirthdayParty::guestCount() const
+qsizetype BirthdayParty::guestCount() const
{
return m_guests.count();
}
-Person *BirthdayParty::guest(int index) const
+Person *BirthdayParty::guest(qsizetype index) const
{
return m_guests.at(index);
}
diff --git a/examples/qml/referenceexamples/signal/birthdayparty.h b/examples/qml/referenceexamples/signal/birthdayparty.h
index 6d7e022df0..c4a4da5dfb 100644
--- a/examples/qml/referenceexamples/signal/birthdayparty.h
+++ b/examples/qml/referenceexamples/signal/birthdayparty.h
@@ -61,7 +61,7 @@ class BirthdayPartyAttached : public QObject
Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp)
QML_ANONYMOUS
public:
- BirthdayPartyAttached(QObject *object);
+ using QObject::QObject;
QDate rsvp() const;
void setRsvp(QDate);
@@ -79,14 +79,14 @@ class BirthdayParty : public QObject
QML_ELEMENT
QML_ATTACHED(BirthdayPartyAttached)
public:
- BirthdayParty(QObject *parent = nullptr);
+ using QObject::QObject;
Person *host() const;
void setHost(Person *);
QQmlListProperty<Person> guests();
- int guestCount() const;
- Person *guest(int) const;
+ qsizetype guestCount() const;
+ Person *guest(qsizetype) const;
static BirthdayPartyAttached *qmlAttachedProperties(QObject *);
@@ -97,7 +97,7 @@ signals:
// ![0]
private:
- Person *m_host;
+ Person *m_host = nullptr;
QList<Person *> m_guests;
};
diff --git a/examples/qml/referenceexamples/signal/main.cpp b/examples/qml/referenceexamples/signal/main.cpp
index 7ef3595a8c..d0b060d8e6 100644
--- a/examples/qml/referenceexamples/signal/main.cpp
+++ b/examples/qml/referenceexamples/signal/main.cpp
@@ -63,14 +63,14 @@ int main(int argc, char ** argv)
auto *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
- qWarning() << party->host()->name() << "is having a birthday!";
+ qInfo() << party->host()->name() << "is having a birthday!";
if (qobject_cast<Boy *>(party->host()))
- qWarning() << "He is inviting:";
+ qInfo() << "He is inviting:";
else
- qWarning() << "She is inviting:";
+ qInfo() << "She is inviting:";
- for (int ii = 0; ii < party->guestCount(); ++ii) {
+ for (qsizetype ii = 0; ii < party->guestCount(); ++ii) {
Person *guest = party->guest(ii);
QDate rsvpDate;
@@ -80,9 +80,9 @@ int main(int argc, char ** argv)
rsvpDate = attached->property("rsvp").toDate();
if (rsvpDate.isNull())
- qWarning() << " " << guest->name() << "RSVP date: Hasn't RSVP'd";
+ qInfo() << " " << guest->name() << "RSVP date: Hasn't RSVP'd";
else
- qWarning() << " " << guest->name() << "RSVP date:" << qPrintable(rsvpDate.toString());
+ qInfo() << " " << guest->name() << "RSVP date:" << rsvpDate.toString();
}
party->startParty();
diff --git a/examples/qml/referenceexamples/signal/person.cpp b/examples/qml/referenceexamples/signal/person.cpp
index 0603644108..4e52da76c8 100644
--- a/examples/qml/referenceexamples/signal/person.cpp
+++ b/examples/qml/referenceexamples/signal/person.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "person.h"
-ShoeDescription::ShoeDescription(QObject *parent)
-: QObject(parent), m_size(0), m_price(0)
-{
-}
+#include "person.h"
int ShoeDescription::size() const
{
@@ -94,11 +90,6 @@ void ShoeDescription::setPrice(qreal p)
m_price = p;
}
-Person::Person(QObject *parent)
-: QObject(parent)
-{
-}
-
QString Person::name() const
{
return m_name;
@@ -113,16 +104,3 @@ ShoeDescription *Person::shoe()
{
return &m_shoe;
}
-
-
-Boy::Boy(QObject * parent)
-: Person(parent)
-{
-}
-
-
-Girl::Girl(QObject * parent)
-: Person(parent)
-{
-}
-
diff --git a/examples/qml/referenceexamples/signal/person.h b/examples/qml/referenceexamples/signal/person.h
index 7283f39f61..ddd3baa5f2 100644
--- a/examples/qml/referenceexamples/signal/person.h
+++ b/examples/qml/referenceexamples/signal/person.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef PERSON_H
#define PERSON_H
@@ -63,7 +64,7 @@ class ShoeDescription : public QObject
Q_PROPERTY(qreal price READ price WRITE setPrice)
QML_ANONYMOUS
public:
- ShoeDescription(QObject *parent = nullptr);
+ using QObject::QObject;
int size() const;
void setSize(int);
@@ -76,11 +77,12 @@ public:
qreal price() const;
void setPrice(qreal);
+
private:
- int m_size;
+ int m_size = 0;
QColor m_color;
QString m_brand;
- qreal m_price;
+ qreal m_price = 0;
};
class Person : public QObject
@@ -90,7 +92,7 @@ class Person : public QObject
Q_PROPERTY(ShoeDescription *shoe READ shoe)
QML_ANONYMOUS
public:
- Person(QObject *parent = nullptr);
+ using QObject::QObject;
QString name() const;
void setName(const QString &);
@@ -106,7 +108,7 @@ class Boy : public Person
Q_OBJECT
QML_ELEMENT
public:
- Boy(QObject * parent = nullptr);
+ using Person::Person;
};
class Girl : public Person
@@ -114,7 +116,7 @@ class Girl : public Person
Q_OBJECT
QML_ELEMENT
public:
- Girl(QObject * parent = nullptr);
+ using Person::Person;
};
#endif // PERSON_H
diff --git a/examples/qml/referenceexamples/valuesource/birthdayparty.cpp b/examples/qml/referenceexamples/valuesource/birthdayparty.cpp
index 7ad11066cb..ced34c0cbb 100644
--- a/examples/qml/referenceexamples/valuesource/birthdayparty.cpp
+++ b/examples/qml/referenceexamples/valuesource/birthdayparty.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "birthdayparty.h"
-BirthdayPartyAttached::BirthdayPartyAttached(QObject *object)
-: QObject(object)
-{
-}
+#include "birthdayparty.h"
QDate BirthdayPartyAttached::rsvp() const
{
@@ -64,12 +60,6 @@ void BirthdayPartyAttached::setRsvp(QDate d)
m_rsvp = d;
}
-
-BirthdayParty::BirthdayParty(QObject *parent)
-: QObject(parent), m_host(nullptr)
-{
-}
-
Person *BirthdayParty::host() const
{
return m_host;
@@ -85,12 +75,12 @@ QQmlListProperty<Person> BirthdayParty::guests()
return {this, &m_guests};
}
-int BirthdayParty::guestCount() const
+qsizetype BirthdayParty::guestCount() const
{
return m_guests.count();
}
-Person *BirthdayParty::guest(int index) const
+Person *BirthdayParty::guest(qsizetype index) const
{
return m_guests.at(index);
}
@@ -108,11 +98,10 @@ QString BirthdayParty::announcement() const
void BirthdayParty::setAnnouncement(const QString &speak)
{
- qWarning() << qPrintable(speak);
+ qInfo().noquote() << speak;
}
BirthdayPartyAttached *BirthdayParty::qmlAttachedProperties(QObject *object)
{
return new BirthdayPartyAttached(object);
}
-
diff --git a/examples/qml/referenceexamples/valuesource/birthdayparty.h b/examples/qml/referenceexamples/valuesource/birthdayparty.h
index abd6363571..4c661499ce 100644
--- a/examples/qml/referenceexamples/valuesource/birthdayparty.h
+++ b/examples/qml/referenceexamples/valuesource/birthdayparty.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef BIRTHDAYPARTY_H
#define BIRTHDAYPARTY_H
@@ -62,7 +63,7 @@ class BirthdayPartyAttached : public QObject
Q_PROPERTY(QDate rsvp READ rsvp WRITE setRsvp)
QML_ANONYMOUS
public:
- BirthdayPartyAttached(QObject *object);
+ using QObject::QObject;
QDate rsvp() const;
void setRsvp(QDate);
@@ -83,14 +84,14 @@ class BirthdayParty : public QObject
QML_ELEMENT
QML_ATTACHED(BirthdayPartyAttached)
public:
- BirthdayParty(QObject *parent = nullptr);
+ using QObject::QObject;
Person *host() const;
void setHost(Person *);
QQmlListProperty<Person> guests();
- int guestCount() const;
- Person *guest(int) const;
+ qsizetype guestCount() const;
+ Person *guest(qsizetype) const;
QString announcement() const;
void setAnnouncement(const QString &);
@@ -98,11 +99,12 @@ public:
static BirthdayPartyAttached *qmlAttachedProperties(QObject *);
void startParty();
+
signals:
void partyStarted(QTime time);
private:
- Person *m_host;
+ Person *m_host = nullptr;
QList<Person *> m_guests;
};
diff --git a/examples/qml/referenceexamples/valuesource/happybirthdaysong.cpp b/examples/qml/referenceexamples/valuesource/happybirthdaysong.cpp
index da09d3d7ba..635a50ef12 100644
--- a/examples/qml/referenceexamples/valuesource/happybirthdaysong.cpp
+++ b/examples/qml/referenceexamples/valuesource/happybirthdaysong.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,13 +47,13 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#include "happybirthdaysong.h"
#include <QTimer>
-HappyBirthdaySong::HappyBirthdaySong(QObject *parent)
-: QObject(parent), m_line(-1)
+HappyBirthdaySong::HappyBirthdaySong(QObject *parent) :
+ QObject(parent)
{
- setName(QString());
auto *timer = new QTimer(this);
QObject::connect(timer, &QTimer::timeout, this, &HappyBirthdaySong::advance);
timer->start(1000);
diff --git a/examples/qml/referenceexamples/valuesource/happybirthdaysong.h b/examples/qml/referenceexamples/valuesource/happybirthdaysong.h
index 2600208968..146e336487 100644
--- a/examples/qml/referenceexamples/valuesource/happybirthdaysong.h
+++ b/examples/qml/referenceexamples/valuesource/happybirthdaysong.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef HAPPYBIRTHDAYSONG_H
#define HAPPYBIRTHDAYSONG_H
@@ -66,7 +67,7 @@ class HappyBirthdaySong : public QObject, public QQmlPropertyValueSource
// ![1]
QML_ELEMENT
public:
- HappyBirthdaySong(QObject *parent = nullptr);
+ explicit HappyBirthdaySong(QObject *parent = nullptr);
void setTarget(const QQmlProperty &) override;
// ![1]
@@ -78,7 +79,7 @@ private slots:
void advance();
private:
- int m_line;
+ qsizetype m_line = -1;
QStringList m_lyrics;
QQmlProperty m_target;
QString m_name;
diff --git a/examples/qml/referenceexamples/valuesource/main.cpp b/examples/qml/referenceexamples/valuesource/main.cpp
index 2e9995fcd8..a100497659 100644
--- a/examples/qml/referenceexamples/valuesource/main.cpp
+++ b/examples/qml/referenceexamples/valuesource/main.cpp
@@ -64,14 +64,14 @@ int main(int argc, char ** argv)
auto *party = qobject_cast<BirthdayParty *>(component.create());
if (party && party->host()) {
- qWarning() << party->host()->name() << "is having a birthday!";
+ qInfo() << party->host()->name() << "is having a birthday!";
if (qobject_cast<Boy *>(party->host()))
- qWarning() << "He is inviting:";
+ qInfo() << "He is inviting:";
else
- qWarning() << "She is inviting:";
+ qInfo() << "She is inviting:";
- for (int ii = 0; ii < party->guestCount(); ++ii) {
+ for (qsizetype ii = 0; ii < party->guestCount(); ++ii) {
Person *guest = party->guest(ii);
QDate rsvpDate;
@@ -81,9 +81,9 @@ int main(int argc, char ** argv)
rsvpDate = attached->property("rsvp").toDate();
if (rsvpDate.isNull())
- qWarning() << " " << guest->name() << "RSVP date: Hasn't RSVP'd";
+ qInfo() << " " << guest->name() << "RSVP date: Hasn't RSVP'd";
else
- qWarning() << " " << guest->name() << "RSVP date:" << qPrintable(rsvpDate.toString());
+ qInfo() << " " << guest->name() << "RSVP date:" << rsvpDate.toString();
}
party->startParty();
diff --git a/examples/qml/referenceexamples/valuesource/person.cpp b/examples/qml/referenceexamples/valuesource/person.cpp
index 0603644108..4e52da76c8 100644
--- a/examples/qml/referenceexamples/valuesource/person.cpp
+++ b/examples/qml/referenceexamples/valuesource/person.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,12 +47,8 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "person.h"
-ShoeDescription::ShoeDescription(QObject *parent)
-: QObject(parent), m_size(0), m_price(0)
-{
-}
+#include "person.h"
int ShoeDescription::size() const
{
@@ -94,11 +90,6 @@ void ShoeDescription::setPrice(qreal p)
m_price = p;
}
-Person::Person(QObject *parent)
-: QObject(parent)
-{
-}
-
QString Person::name() const
{
return m_name;
@@ -113,16 +104,3 @@ ShoeDescription *Person::shoe()
{
return &m_shoe;
}
-
-
-Boy::Boy(QObject * parent)
-: Person(parent)
-{
-}
-
-
-Girl::Girl(QObject * parent)
-: Person(parent)
-{
-}
-
diff --git a/examples/qml/referenceexamples/valuesource/person.h b/examples/qml/referenceexamples/valuesource/person.h
index 7283f39f61..ed77f8c4d8 100644
--- a/examples/qml/referenceexamples/valuesource/person.h
+++ b/examples/qml/referenceexamples/valuesource/person.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,6 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
+
#ifndef PERSON_H
#define PERSON_H
@@ -63,7 +64,7 @@ class ShoeDescription : public QObject
Q_PROPERTY(qreal price READ price WRITE setPrice)
QML_ANONYMOUS
public:
- ShoeDescription(QObject *parent = nullptr);
+ using QObject::QObject;
int size() const;
void setSize(int);
@@ -76,21 +77,24 @@ public:
qreal price() const;
void setPrice(qreal);
+
private:
- int m_size;
+ int m_size = 0;
QColor m_color;
QString m_brand;
- qreal m_price;
+ qreal m_price = 0;
};
class Person : public QObject
{
Q_OBJECT
Q_PROPERTY(QString name READ name WRITE setName)
+// ![1]
Q_PROPERTY(ShoeDescription *shoe READ shoe)
+// ![1]
QML_ANONYMOUS
public:
- Person(QObject *parent = nullptr);
+ using QObject::QObject;
QString name() const;
void setName(const QString &);
@@ -106,7 +110,7 @@ class Boy : public Person
Q_OBJECT
QML_ELEMENT
public:
- Boy(QObject * parent = nullptr);
+ using Person::Person;
};
class Girl : public Person
@@ -114,7 +118,7 @@ class Girl : public Person
Q_OBJECT
QML_ELEMENT
public:
- Girl(QObject * parent = nullptr);
+ using Person::Person;
};
#endif // PERSON_H
diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter1-basics/CMakeLists.txt
index c04b465254..146ba6c887 100644
--- a/examples/qml/tutorials/extending-qml/chapter1-basics/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter1-basics/CMakeLists.txt
@@ -40,6 +40,7 @@ qt_add_qml_module(chapter1-basics
VERSION 1.0
QML_FILES app.qml
NO_RESOURCE_TARGET_PATH
+ DEPENDENCIES QtQuick
)
install(TARGETS chapter1-basics
diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/piechart.h b/examples/qml/tutorials/extending-qml/chapter1-basics/piechart.h
index 687f8e2b4d..742f8ec0fd 100644
--- a/examples/qml/tutorials/extending-qml/chapter1-basics/piechart.h
+++ b/examples/qml/tutorials/extending-qml/chapter1-basics/piechart.h
@@ -57,8 +57,8 @@
class PieChart : public QQuickPaintedItem
{
Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(QColor color READ color WRITE setColor)
+ Q_PROPERTY(QString name READ name WRITE setName FINAL)
+ Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
QML_ELEMENT
public:
diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt
index 993c235965..c5e066cad0 100644
--- a/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter2-methods/CMakeLists.txt
@@ -40,6 +40,7 @@ qt_add_qml_module(chapter2-methods
VERSION 1.0
QML_FILES app.qml
NO_RESOURCE_TARGET_PATH
+ DEPENDENCIES QtQuick
)
install(TARGETS chapter2-methods
diff --git a/examples/qml/tutorials/extending-qml/chapter2-methods/piechart.h b/examples/qml/tutorials/extending-qml/chapter2-methods/piechart.h
index 271afbf653..6457a8561d 100644
--- a/examples/qml/tutorials/extending-qml/chapter2-methods/piechart.h
+++ b/examples/qml/tutorials/extending-qml/chapter2-methods/piechart.h
@@ -58,8 +58,8 @@ class PieChart : public QQuickPaintedItem
{
//![0]
Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName)
- Q_PROPERTY(QColor color READ color WRITE setColor)
+ Q_PROPERTY(QString name READ name WRITE setName FINAL)
+ Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
QML_ELEMENT
//![1]
public:
diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter3-bindings/CMakeLists.txt
index f600ae5389..184f440c1d 100644
--- a/examples/qml/tutorials/extending-qml/chapter3-bindings/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/CMakeLists.txt
@@ -40,6 +40,7 @@ qt_add_qml_module(chapter3-bindings
VERSION 1.0
QML_FILES app.qml
NO_RESOURCE_TARGET_PATH
+ DEPENDENCIES QtQuick
)
install(TARGETS chapter3-bindings
diff --git a/examples/qml/tutorials/extending-qml/chapter3-bindings/piechart.h b/examples/qml/tutorials/extending-qml/chapter3-bindings/piechart.h
index 58b1339298..ef3f6a79dc 100644
--- a/examples/qml/tutorials/extending-qml/chapter3-bindings/piechart.h
+++ b/examples/qml/tutorials/extending-qml/chapter3-bindings/piechart.h
@@ -58,11 +58,11 @@ class PieChart : public QQuickPaintedItem
{
//![0]
Q_OBJECT
- Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(QString name READ name WRITE setName FINAL)
QML_ELEMENT
//![1]
- Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
+ Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged FINAL)
public:
//![1]
diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/CMakeLists.txt
index 50e231bb7d..51855394e3 100644
--- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/CMakeLists.txt
@@ -41,6 +41,7 @@ qt_add_qml_module(chapter4-customPropertyTypes
VERSION 1.0
QML_FILES app.qml
NO_RESOURCE_TARGET_PATH
+ DEPENDENCIES QtQuick
)
install(TARGETS chapter4-customPropertyTypes
diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.h b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.h
index 855ad7ae3a..57ef7d90e2 100644
--- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.h
+++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/piechart.h
@@ -58,9 +58,9 @@ class PieSlice;
class PieChart : public QQuickItem
{
Q_OBJECT
- Q_PROPERTY(PieSlice* pieSlice READ pieSlice WRITE setPieSlice)
+ Q_PROPERTY(PieSlice* pieSlice READ pieSlice WRITE setPieSlice FINAL)
//![0]
- Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(QString name READ name WRITE setName FINAL)
Q_MOC_INCLUDE("pieslice.h")
QML_ELEMENT
//![1]
diff --git a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h
index 6e64917851..84d1789e56 100644
--- a/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h
+++ b/examples/qml/tutorials/extending-qml/chapter4-customPropertyTypes/pieslice.h
@@ -57,7 +57,7 @@
class PieSlice : public QQuickPaintedItem
{
Q_OBJECT
- Q_PROPERTY(QColor color READ color WRITE setColor)
+ Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
QML_ELEMENT
public:
diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter5-listproperties/CMakeLists.txt
index 1891bc34d5..ac3f7839ab 100644
--- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/CMakeLists.txt
@@ -41,6 +41,7 @@ qt_add_qml_module(chapter5-listproperties
VERSION 1.0
QML_FILES app.qml
NO_RESOURCE_TARGET_PATH
+ DEPENDENCIES QtQuick
)
install(TARGETS chapter5-listproperties
diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.h b/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.h
index 236fa6796f..3caa80ed53 100644
--- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.h
+++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/piechart.h
@@ -58,9 +58,9 @@ class PieSlice;
class PieChart : public QQuickItem
{
Q_OBJECT
- Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices)
+ Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices FINAL)
//![0]
- Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(QString name READ name WRITE setName FINAL)
QML_ELEMENT
//![1]
diff --git a/examples/qml/tutorials/extending-qml/chapter5-listproperties/pieslice.h b/examples/qml/tutorials/extending-qml/chapter5-listproperties/pieslice.h
index 0b290851f0..50c573c7bc 100644
--- a/examples/qml/tutorials/extending-qml/chapter5-listproperties/pieslice.h
+++ b/examples/qml/tutorials/extending-qml/chapter5-listproperties/pieslice.h
@@ -57,9 +57,9 @@
class PieSlice : public QQuickPaintedItem
{
Q_OBJECT
- Q_PROPERTY(QColor color READ color WRITE setColor)
- Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle)
- Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan)
+ Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
+ Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle FINAL)
+ Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan FINAL)
QML_ELEMENT
//![0]
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt
index 28efcaace8..62d4c71fc4 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt
@@ -2,6 +2,7 @@ qt6_add_qml_module(chartsplugin
VERSION 1.0
URI "Charts"
PLUGIN_TARGET chartsplugin
+ DEPENDENCIES QtQuick
)
target_sources(chartsplugin PRIVATE
@@ -44,3 +45,5 @@ install(TARGETS chartsplugin
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qmldir
+ DESTINATION "${INSTALL_EXAMPLEDIR}")
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h
index e6b768b274..d48f217ea4 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/piechart.h
@@ -57,8 +57,8 @@ class PieSlice;
class PieChart : public QQuickItem
{
Q_OBJECT
- Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices)
- Q_PROPERTY(QString name READ name WRITE setName)
+ Q_PROPERTY(QQmlListProperty<PieSlice> slices READ slices FINAL)
+ Q_PROPERTY(QString name READ name WRITE setName FINAL)
QML_ELEMENT
public:
diff --git a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h
index 091870bd51..965b50f058 100644
--- a/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h
+++ b/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/pieslice.h
@@ -56,9 +56,9 @@
class PieSlice : public QQuickPaintedItem
{
Q_OBJECT
- Q_PROPERTY(QColor color READ color WRITE setColor)
- Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle)
- Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan)
+ Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
+ Q_PROPERTY(int fromAngle READ fromAngle WRITE setFromAngle FINAL)
+ Q_PROPERTY(int angleSpan READ angleSpan WRITE setAngleSpan FINAL)
QML_ELEMENT
public:
diff --git a/examples/quick/CMakeLists.txt b/examples/quick/CMakeLists.txt
index d1bca0c8a1..e138f7039a 100644
--- a/examples/quick/CMakeLists.txt
+++ b/examples/quick/CMakeLists.txt
@@ -8,7 +8,7 @@ qt_internal_add_example(canvas)
qt_internal_add_example(imageelements)
qt_internal_add_example(keyinteraction)
qt_internal_add_example(layouts)
-add_subdirectory(localstorage)
+qt_internal_add_example(localstorage)
add_subdirectory(models)
qt_internal_add_example(views)
add_subdirectory(tableview)
@@ -54,6 +54,11 @@ set(reused_dir_targets
imageelements_shared
delegatechooser_shared
pointerhandlers_shared
+ affectors_shared
+ emitters_shared
+ imageparticle_shared
+ itemparticle_shared
+ system_shared
draganddrop_shared
)
foreach(target IN LISTS reused_dir_targets)
diff --git a/examples/quick/customitems/painteditem/TextBalloon/CMakeLists.txt b/examples/quick/customitems/painteditem/TextBalloon/CMakeLists.txt
index eb0ef1fd87..fb2bf7568e 100644
--- a/examples/quick/customitems/painteditem/TextBalloon/CMakeLists.txt
+++ b/examples/quick/customitems/painteditem/TextBalloon/CMakeLists.txt
@@ -1,3 +1,7 @@
+if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+ message(FATAL_ERROR "TextBalloon should be built as part of the 'painteditem' project, and not in isolation.")
+endif()
+
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/customitems/painteditem/TextBalloon")
qt_add_qml_module(qmltextballoon
diff --git a/examples/quick/draganddrop/tiles/DragTile.qml b/examples/quick/draganddrop/tiles/DragTile.qml
index 47f0ebed5e..1762ca8327 100644
--- a/examples/quick/draganddrop/tiles/DragTile.qml
+++ b/examples/quick/draganddrop/tiles/DragTile.qml
@@ -94,10 +94,8 @@ Item {
//! [1]
states: State {
when: mouseArea.drag.active
- ParentChange { target: tile; parent: root }
AnchorChanges { target: tile; anchors.verticalCenter: undefined; anchors.horizontalCenter: undefined }
}
-
}
}
}
diff --git a/examples/quick/embeddedinwidgets/CMakeLists.txt b/examples/quick/embeddedinwidgets/CMakeLists.txt
index c1cb79e027..9f90d696b7 100644
--- a/examples/quick/embeddedinwidgets/CMakeLists.txt
+++ b/examples/quick/embeddedinwidgets/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from embeddedinwidgets.pro.
-
cmake_minimum_required(VERSION 3.16)
project(embeddedinwidgets LANGUAGES CXX)
@@ -7,7 +5,6 @@ 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")
@@ -15,20 +12,12 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/embeddedinwidgets")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS ShaderTools)
+find_package(Qt6 COMPONENTS Core Gui Widgets Quick)
-qt_add_executable(embeddedinwidgets
+qt_add_executable(embeddedinwidgetsexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(embeddedinwidgets PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(embeddedinwidgets PUBLIC
+target_link_libraries(embeddedinwidgetsexample PRIVATE
Qt::Core
Qt::Gui
Qt::Quick
@@ -37,27 +26,16 @@ target_link_libraries(embeddedinwidgets PUBLIC
# Resources:
-set(embeddedinwidgets_resource_files
- "main.qml"
-)
-
-qt6_add_resources(embeddedinwidgets "embeddedinwidgets"
- PREFIX
- "/embeddedinwidgets"
- FILES
- ${embeddedinwidgets_resource_files}
-)
-
-qt6_add_shaders(embeddedinwidgets "shaders"
- PRECOMPILE
- OPTIMIZED
- PREFIX
- "/embeddedinwidgets"
- FILES
- "reflect.frag"
+qt_add_qml_module(embeddedinwidgetsexample
+ URI embeddedinwidgets
+ VERSION 1.0
+ QML_FILES
+ "main.qml"
+ RESOURCES
+ "reflect.frag.qsb"
)
-install(TARGETS embeddedinwidgets
+install(TARGETS embeddedinwidgetsexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/quick/keyinteraction/CMakeLists.txt b/examples/quick/keyinteraction/CMakeLists.txt
index ffb8c8924a..e338c11024 100644
--- a/examples/quick/keyinteraction/CMakeLists.txt
+++ b/examples/quick/keyinteraction/CMakeLists.txt
@@ -1,13 +1,9 @@
-# Generated from keyinteraction.pro.
-
cmake_minimum_required(VERSION 3.16)
project(keyinteraction 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")
@@ -15,47 +11,36 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/keyinteraction")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
+find_package(Qt6 COMPONENTS Core Gui Quick Qml)
-qt_add_executable(keyinteraction
+qt_add_executable(keyinteractionexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(keyinteraction PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(keyinteraction PUBLIC
+target_link_libraries(keyinteractionexample PRIVATE
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
)
-
# Resources:
-set(keyinteraction_resource_files
- "focus/Core/ContextMenu.qml"
- "focus/Core/GridMenu.qml"
- "focus/Core/ListMenu.qml"
- "focus/Core/ListViewDelegate.qml"
- "focus/Core/TabMenu.qml"
- "focus/Core/images/arrow.png"
- "focus/Core/images/qt-logo.png"
- "focus/focus.qml"
- "keyinteraction.qml"
-)
-
-qt6_add_resources(keyinteraction "keyinteraction"
- PREFIX
- "/keyinteraction"
- FILES
- ${keyinteraction_resource_files}
+qt_add_qml_module(keyinteractionexample
+ URI keyinteraction
+ VERSION 1.0
+ QML_FILES
+ "ContextMenu.qml"
+ "GridMenu.qml"
+ "ListMenu.qml"
+ "ListViewDelegate.qml"
+ "TabMenu.qml"
+ "focus.qml"
+ "keyinteraction.qml"
+ RESOURCES
+ "images/arrow.png"
+ "images/qt-logo.png"
)
-install(TARGETS keyinteraction
+install(TARGETS keyinteractionexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/quick/keyinteraction/focus/Core/ContextMenu.qml b/examples/quick/keyinteraction/ContextMenu.qml
index 31b5e1b83d..66dcdf3fe8 100644
--- a/examples/quick/keyinteraction/focus/Core/ContextMenu.qml
+++ b/examples/quick/keyinteraction/ContextMenu.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.1
+import QtQuick
FocusScope {
id: container
diff --git a/examples/quick/keyinteraction/focus/Core/GridMenu.qml b/examples/quick/keyinteraction/GridMenu.qml
index 78d6654957..d5914fe4d6 100644
--- a/examples/quick/keyinteraction/focus/Core/GridMenu.qml
+++ b/examples/quick/keyinteraction/GridMenu.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.1
+import QtQuick
FocusScope {
id: menu
diff --git a/examples/quick/keyinteraction/focus/Core/ListMenu.qml b/examples/quick/keyinteraction/ListMenu.qml
index 694ae3cac6..97a37a714b 100644
--- a/examples/quick/keyinteraction/focus/Core/ListMenu.qml
+++ b/examples/quick/keyinteraction/ListMenu.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQml 2.1
-import QtQuick 2.1
+import QtQml
+import QtQuick
FocusScope {
id: menu
diff --git a/examples/quick/keyinteraction/focus/Core/ListViewDelegate.qml b/examples/quick/keyinteraction/ListViewDelegate.qml
index 5a2957eab0..1d14f22195 100644
--- a/examples/quick/keyinteraction/focus/Core/ListViewDelegate.qml
+++ b/examples/quick/keyinteraction/ListViewDelegate.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.1
+import QtQuick
Item {
id: container
diff --git a/examples/quick/keyinteraction/focus/Core/TabMenu.qml b/examples/quick/keyinteraction/TabMenu.qml
index 11b3d005c3..cfa38e958c 100644
--- a/examples/quick/keyinteraction/focus/Core/TabMenu.qml
+++ b/examples/quick/keyinteraction/TabMenu.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.1
+import QtQuick
FocusScope {
id: menu
diff --git a/examples/quick/keyinteraction/focus/focus.qml b/examples/quick/keyinteraction/focus.qml
index 9db9ab48bc..7b1452ba35 100644
--- a/examples/quick/keyinteraction/focus/focus.qml
+++ b/examples/quick/keyinteraction/focus.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,9 +48,8 @@
**
****************************************************************************/
-import QtQml 2.1
-import QtQuick 2.1
-import "Core"
+import QtQml
+import QtQuick
Rectangle {
id: window
@@ -145,7 +144,7 @@ Rectangle {
}
Image {
- source: "Core/images/arrow.png"
+ source: "images/arrow.png"
rotation: 90
anchors.verticalCenter: parent.verticalCenter
diff --git a/examples/quick/keyinteraction/focus/Core/images/arrow.png b/examples/quick/keyinteraction/images/arrow.png
index 20ee200f5f..20ee200f5f 100644
--- a/examples/quick/keyinteraction/focus/Core/images/arrow.png
+++ b/examples/quick/keyinteraction/images/arrow.png
Binary files differ
diff --git a/examples/quick/keyinteraction/focus/Core/images/qt-logo.png b/examples/quick/keyinteraction/images/qt-logo.png
index 14ddf2a028..14ddf2a028 100644
--- a/examples/quick/keyinteraction/focus/Core/images/qt-logo.png
+++ b/examples/quick/keyinteraction/images/qt-logo.png
Binary files differ
diff --git a/examples/quick/keyinteraction/keyinteraction.qml b/examples/quick/keyinteraction/keyinteraction.qml
index 7fa3078803..c79ba7217e 100644
--- a/examples/quick/keyinteraction/keyinteraction.qml
+++ b/examples/quick/keyinteraction/keyinteraction.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,10 +48,10 @@
**
****************************************************************************/
-import QtQuick 2.1
+import QtQuick
Loader {//Just loader, since there's only one.
- source: "focus/focus.qml"
+ source: "focus.qml"
focus: true
// Exception to the standard sizing, because this is primarily a desktop
// example and it benefits from being able to see everything at once.
diff --git a/examples/quick/keyinteraction/keyinteraction.qrc b/examples/quick/keyinteraction/keyinteraction.qrc
index c719654835..8738ef9826 100644
--- a/examples/quick/keyinteraction/keyinteraction.qrc
+++ b/examples/quick/keyinteraction/keyinteraction.qrc
@@ -1,13 +1,13 @@
<RCC>
<qresource prefix="/keyinteraction">
<file>keyinteraction.qml</file>
- <file>focus/focus.qml</file>
- <file>focus/Core/images/arrow.png</file>
- <file>focus/Core/images/qt-logo.png</file>
- <file>focus/Core/ContextMenu.qml</file>
- <file>focus/Core/GridMenu.qml</file>
- <file>focus/Core/ListMenu.qml</file>
- <file>focus/Core/ListViewDelegate.qml</file>
- <file>focus/Core/TabMenu.qml</file>
+ <file>focus.qml</file>
+ <file>ContextMenu.qml</file>
+ <file>GridMenu.qml</file>
+ <file>ListMenu.qml</file>
+ <file>ListViewDelegate.qml</file>
+ <file>TabMenu.qml</file>
+ <file>images/arrow.png</file>
+ <file>images/qt-logo.png</file>
</qresource>
</RCC>
diff --git a/examples/quick/models/abstractitemmodel/CMakeLists.txt b/examples/quick/models/abstractitemmodel/CMakeLists.txt
index 240f171c41..486e6d376a 100644
--- a/examples/quick/models/abstractitemmodel/CMakeLists.txt
+++ b/examples/quick/models/abstractitemmodel/CMakeLists.txt
@@ -7,7 +7,6 @@ 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")
@@ -15,20 +14,13 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/models/abstractitemmodel")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
+find_package(Qt6 COMPONENTS Core Gui Qml Quick)
-qt_add_executable(abstractitemmodel
+qt_add_executable(abstractitemmodelexample WIN32 MACOSX_BUNDLE
main.cpp
- model.cpp model.h
+ model.cpp
)
-set_target_properties(abstractitemmodel PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(abstractitemmodel PUBLIC
+target_link_libraries(abstractitemmodelexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
@@ -37,18 +29,14 @@ target_link_libraries(abstractitemmodel PUBLIC
# Resources:
-set(abstractitemmodel_resource_files
- "view.qml"
-)
-
-qt6_add_resources(abstractitemmodel "abstractitemmodel"
- PREFIX
- "/"
- FILES
- ${abstractitemmodel_resource_files}
+qt_add_qml_module(abstractitemmodelexample
+ URI abstractitemmodel
+ VERSION 1.0
+ QML_FILES
+ "view.qml"
)
-install(TARGETS abstractitemmodel
+install(TARGETS abstractitemmodelexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/quick/models/abstractitemmodel/abstractitemmodel.qrc b/examples/quick/models/abstractitemmodel/abstractitemmodel.qrc
index 4ae861cb3d..ad8c2df8ae 100644
--- a/examples/quick/models/abstractitemmodel/abstractitemmodel.qrc
+++ b/examples/quick/models/abstractitemmodel/abstractitemmodel.qrc
@@ -1,5 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
+<qresource prefix="/abstractitemmodel">
<file>view.qml</file>
</qresource>
</RCC>
diff --git a/examples/quick/models/abstractitemmodel/main.cpp b/examples/quick/models/abstractitemmodel/main.cpp
index dd5b368c6b..9e820391f6 100644
--- a/examples/quick/models/abstractitemmodel/main.cpp
+++ b/examples/quick/models/abstractitemmodel/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -70,7 +70,7 @@ int main(int argc, char ** argv)
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setInitialProperties({{"model", QVariant::fromValue(&model)}});
//![0]
- view.setSource(QUrl("qrc:view.qml"));
+ view.setSource(QUrl("qrc:/abstractitemmodel/view.qml"));
view.show();
return app.exec();
diff --git a/examples/quick/models/abstractitemmodel/model.cpp b/examples/quick/models/abstractitemmodel/model.cpp
index 9d0032e34c..c58e05577a 100644
--- a/examples/quick/models/abstractitemmodel/model.cpp
+++ b/examples/quick/models/abstractitemmodel/model.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
diff --git a/examples/quick/models/abstractitemmodel/view.qml b/examples/quick/models/abstractitemmodel/view.qml
index 2b9f87df92..f80c4dca72 100644
--- a/examples/quick/models/abstractitemmodel/view.qml
+++ b/examples/quick/models/abstractitemmodel/view.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -47,7 +47,7 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-import QtQuick 2.0
+import QtQuick
//![0]
ListView {
diff --git a/examples/quick/models/objectlistmodel/CMakeLists.txt b/examples/quick/models/objectlistmodel/CMakeLists.txt
index 60fdeea219..8dbee3ae0b 100644
--- a/examples/quick/models/objectlistmodel/CMakeLists.txt
+++ b/examples/quick/models/objectlistmodel/CMakeLists.txt
@@ -7,7 +7,6 @@ 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")
@@ -15,20 +14,13 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/models/objectlistmodel")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
+find_package(Qt6 COMPONENTS Core Gui Qml Quick)
-qt_add_executable(objectlistmodel
- dataobject.cpp dataobject.h
+qt_add_executable(objectlistmodelexample WIN32 MACOSX_BUNDLE
+ dataobject.cpp
main.cpp
)
-set_target_properties(objectlistmodel PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(objectlistmodel PUBLIC
+target_link_libraries(objectlistmodelexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
@@ -37,18 +29,14 @@ target_link_libraries(objectlistmodel PUBLIC
# Resources:
-set(objectlistmodel_resource_files
- "view.qml"
-)
-
-qt6_add_resources(objectlistmodel "objectlistmodel"
- PREFIX
- "/"
- FILES
- ${objectlistmodel_resource_files}
+qt_add_qml_module(objectlistmodelexample
+ URI objectlistmodel
+ VERSION 1.0
+ QML_FILES
+ "view.qml"
)
-install(TARGETS objectlistmodel
+install(TARGETS objectlistmodelexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/quick/models/objectlistmodel/dataobject.cpp b/examples/quick/models/objectlistmodel/dataobject.cpp
index 6963d75c42..354b9d74b4 100644
--- a/examples/quick/models/objectlistmodel/dataobject.cpp
+++ b/examples/quick/models/objectlistmodel/dataobject.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
diff --git a/examples/quick/models/objectlistmodel/main.cpp b/examples/quick/models/objectlistmodel/main.cpp
index 8fbe7c183c..5d406f356c 100644
--- a/examples/quick/models/objectlistmodel/main.cpp
+++ b/examples/quick/models/objectlistmodel/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the demonstration applications of the Qt Toolkit.
@@ -49,6 +49,7 @@
****************************************************************************/
#include <QGuiApplication>
+#include <QList>
#include <qqmlengine.h>
#include <qqmlcontext.h>
@@ -68,21 +69,36 @@ int main(int argc, char ** argv)
{
QGuiApplication app(argc, argv);
- QList<QObject *> dataList = {
- new DataObject("Item 1", "red"),
- new DataObject("Item 2", "green"),
- new DataObject("Item 3", "blue"),
- new DataObject("Item 4", "yellow")
- };
+ const QStringList colorList = {"red",
+ "green",
+ "blue",
+ "yellow"};
+
+ const QStringList moduleList = {"Core", "GUI", "Multimedia", "Multimedia Widgets", "Network",
+ "QML", "Quick", "Quick Controls", "Quick Dialogs",
+ "Quick Layouts", "Quick Test", "SQL", "Widgets", "3D",
+ "Android Extras", "Bluetooth", "Concurrent", "D-Bus",
+ "Gamepad", "Graphical Effects", "Help", "Image Formats",
+ "Location", "Mac Extras", "NFC", "OpenGL", "Platform Headers",
+ "Positioning", "Print Support", "Purchasing", "Quick Extras",
+ "Quick Timeline", "Quick Widgets", "Remote Objects", "Script",
+ "SCXML", "Script Tools", "Sensors", "Serial Bus",
+ "Serial Port", "Speech", "SVG", "UI Tools", "WebEngine",
+ "WebSockets", "WebView", "Windows Extras", "XML",
+ "XML Patterns", "Charts", "Network Authorization",
+ "Virtual Keyboard", "Quick 3D", "Quick WebGL"};
+
+ QList<QObject *> dataList;
+ for (const QString &module : moduleList)
+ dataList.append(new DataObject("Qt " + module, colorList.at(rand() % colorList.length())));
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.setInitialProperties({{ "model", QVariant::fromValue(dataList) }});
//![0]
- view.setSource(QUrl("qrc:view.qml"));
+ view.setSource(QUrl("qrc:/objectlistmodel/view.qml"));
view.show();
return app.exec();
}
-
diff --git a/examples/quick/models/objectlistmodel/objectlistmodel.qrc b/examples/quick/models/objectlistmodel/objectlistmodel.qrc
index 17e9301471..a6e8cffb08 100644
--- a/examples/quick/models/objectlistmodel/objectlistmodel.qrc
+++ b/examples/quick/models/objectlistmodel/objectlistmodel.qrc
@@ -1,5 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
+<qresource prefix="/objectlistmodel">
<file>view.qml</file>
</qresource>
</RCC>
diff --git a/examples/quick/models/objectlistmodel/view.qml b/examples/quick/models/objectlistmodel/view.qml
index ba0c905e1e..4adc8ca84f 100644
--- a/examples/quick/models/objectlistmodel/view.qml
+++ b/examples/quick/models/objectlistmodel/view.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,19 +48,22 @@
**
****************************************************************************/
-import QtQuick 2.0
+import QtQuick
+import QtQuick.Controls
//![0]
ListView {
- width: 100; height: 100
+ id: listview
+ width: 200; height: 320
required model
+ ScrollBar.vertical: ScrollBar { }
delegate: Rectangle {
+ width: listview.width; height: 25
+
required color
required property string name
- height: 25
- width: 100
Text { text: parent.name }
}
}
diff --git a/examples/quick/models/stringlistmodel/CMakeLists.txt b/examples/quick/models/stringlistmodel/CMakeLists.txt
index ab7b099434..3bfb3ca4bf 100644
--- a/examples/quick/models/stringlistmodel/CMakeLists.txt
+++ b/examples/quick/models/stringlistmodel/CMakeLists.txt
@@ -7,7 +7,6 @@ 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")
@@ -15,19 +14,12 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/models/stringlistmodel")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
+find_package(Qt6 COMPONENTS Core Gui Qml Quick)
-qt_add_executable(stringlistmodel
+qt_add_executable(stringlistmodelexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(stringlistmodel PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(stringlistmodel PUBLIC
+target_link_libraries(stringlistmodelexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
@@ -36,18 +28,14 @@ target_link_libraries(stringlistmodel PUBLIC
# Resources:
-set(stringlistmodel_resource_files
- "view.qml"
-)
-
-qt6_add_resources(stringlistmodel "stringlistmodel"
- PREFIX
- "/"
- FILES
- ${stringlistmodel_resource_files}
+qt_add_qml_module(stringlistmodelexample
+ URI stringlistmodel
+ VERSION 1.0
+ QML_FILES
+ "view.qml"
)
-install(TARGETS stringlistmodel
+install(TARGETS stringlistmodelexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/quick/models/stringlistmodel/main.cpp b/examples/quick/models/stringlistmodel/main.cpp
index d9de69b3aa..f3319d0f3e 100644
--- a/examples/quick/models/stringlistmodel/main.cpp
+++ b/examples/quick/models/stringlistmodel/main.cpp
@@ -79,7 +79,7 @@ int main(int argc, char ** argv)
view.setInitialProperties({{ "model", QVariant::fromValue(dataList) }});
//![0]
- view.setSource(QUrl("qrc:view.qml"));
+ view.setSource(QUrl("qrc:/stringlistmodel/view.qml"));
view.show();
return app.exec();
diff --git a/examples/quick/models/stringlistmodel/stringlistmodel.qrc b/examples/quick/models/stringlistmodel/stringlistmodel.qrc
index 17e9301471..31928f0738 100644
--- a/examples/quick/models/stringlistmodel/stringlistmodel.qrc
+++ b/examples/quick/models/stringlistmodel/stringlistmodel.qrc
@@ -1,5 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
+<qresource prefix="/stringlistmodel">
<file>view.qml</file>
</qresource>
</RCC>
diff --git a/examples/quick/mousearea/CMakeLists.txt b/examples/quick/mousearea/CMakeLists.txt
index 190e34b172..ea635462be 100644
--- a/examples/quick/mousearea/CMakeLists.txt
+++ b/examples/quick/mousearea/CMakeLists.txt
@@ -1,13 +1,9 @@
-# Generated from mousearea.pro.
-
cmake_minimum_required(VERSION 3.16)
project(mousearea 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")
@@ -15,19 +11,12 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/mousearea")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
+find_package(Qt6 COMPONENTS Core Gui Quick Qml)
-qt_add_executable(mousearea
+qt_add_executable(mouseareaexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(mousearea PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(mousearea PUBLIC
+target_link_libraries(mouseareaexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
@@ -36,19 +25,15 @@ target_link_libraries(mousearea PUBLIC
# Resources:
-set(mousearea_resource_files
- "mousearea-wheel-example.qml"
- "mousearea.qml"
-)
-
-qt6_add_resources(mousearea "mousearea"
- PREFIX
- "/mousearea"
- FILES
- ${mousearea_resource_files}
+qt_add_qml_module(mouseareaexample
+ URI mousearea
+ VERSION 1.0
+ QML_FILES
+ "mousearea-wheel-example.qml"
+ "mousearea.qml"
)
-install(TARGETS mousearea
+install(TARGETS mouseareaexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/quick/mousearea/mousearea-wheel-example.qml b/examples/quick/mousearea/mousearea-wheel-example.qml
index 5e8fba3ac3..77893fd57c 100644
--- a/examples/quick/mousearea/mousearea-wheel-example.qml
+++ b/examples/quick/mousearea/mousearea-wheel-example.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.0
+import QtQuick
Rectangle {
height: 700
diff --git a/examples/quick/mousearea/mousearea.qml b/examples/quick/mousearea/mousearea.qml
index ff792f952d..677b5f384d 100644
--- a/examples/quick/mousearea/mousearea.qml
+++ b/examples/quick/mousearea/mousearea.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.4
+import QtQuick
Rectangle {
id: box
@@ -177,7 +177,7 @@ Rectangle {
id: info
anchors.bottom: btn.top; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 20
- onTextChanged: console.log(text)
+ onTextChanged: function(text) { console.log(text) }
}
Text {
diff --git a/examples/quick/particles/affectors/CMakeLists.txt b/examples/quick/particles/affectors/CMakeLists.txt
index c082bea86d..9434063429 100644
--- a/examples/quick/particles/affectors/CMakeLists.txt
+++ b/examples/quick/particles/affectors/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from affectors.pro.
-
cmake_minimum_required(VERSION 3.16)
project(affectors LANGUAGES CXX)
@@ -7,7 +5,6 @@ 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")
@@ -15,119 +12,61 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/affectors")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
+find_package(Qt6 COMPONENTS Core Gui Quick Qml)
+
+add_subdirectory("../../shared" "shared")
-qt_add_executable(affectors
+qt_add_executable(affectorsexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(affectors PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(affectors PUBLIC
+target_link_libraries(affectorsexample PRIVATE
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
)
+add_dependencies(affectorsexample affectors_shared)
# Resources:
-set(affectors_resource_files
- "affectors.qml"
- "content/GreyButton.qml"
- "content/age.qml"
- "content/attractor.qml"
- "content/customaffector.qml"
- "content/friction.qml"
- "content/gravity.qml"
- "content/groupgoal.qml"
- "content/move.qml"
- "content/spritegoal.qml"
- "content/turbulence.qml"
- "content/wander.qml"
-)
-
-qt6_add_resources(affectors "affectors"
- PREFIX
- "/particles/affectors"
- FILES
- ${affectors_resource_files}
-)
-set(images_resource_files
- "../images/_explo.png"
- "../images/backgroundLeaves.jpg"
- "../images/bear_tiles.png"
- "../images/candle.png"
- "../images/colortable.png"
- "../images/finalfrontier.png"
- "../images/flower.png"
- "../images/matchmask.png"
- "../images/meteor.png"
- "../images/meteor_explo.png"
- "../images/meteors.png"
- "../images/nullRock.png"
- "../images/particle2.png"
- "../images/particle3.png"
- "../images/particleA.png"
- "../images/portal_bg.png"
- "../images/realLeaf1.png"
- "../images/realLeaf2.png"
- "../images/realLeaf3.png"
- "../images/realLeaf4.png"
- "../images/rocket.png"
- "../images/rocket2.png"
- "../images/sizeInOut.png"
- "../images/snowflake.png"
- "../images/sparkleSize.png"
- "../images/starfish_0.png"
- "../images/starfish_1.png"
- "../images/starfish_2.png"
- "../images/starfish_3.png"
- "../images/starfish_4.png"
- "../images/starfish_mask.png"
+qt_add_qml_module(affectorsexample
+ URI affectors
+ VERSION 1.0
+ QML_FILES
+ "affectors.qml"
+ "GreyButton.qml"
+ "age.qml"
+ "attractor.qml"
+ "customaffector.qml"
+ "friction.qml"
+ "gravity.qml"
+ "groupgoal.qml"
+ "move.qml"
+ "spritegoal.qml"
+ "turbulence.qml"
+ "wander.qml"
+ RESOURCES
+ "images/snowflake.png"
+ "images/finalfrontier.png"
+ "images/meteor.png"
+ "images/rocket.png"
+ "images/rocket2.png"
+ "images/backgroundLeaves.jpg"
+ "images/realLeaf1.png"
+ "images/realLeaf2.png"
+ "images/realLeaf3.png"
+ "images/realLeaf4.png"
+ "images/particleA.png"
+ "images/matchmask.png"
+ "images/nullRock.png"
+ "images/_explo.png"
+ "images/candle.png"
)
-qt6_add_resources(affectors "images"
- PREFIX
- "/particles"
- BASE
- ".."
- FILES
- ${images_resource_files}
-)
-set(shared_resource_files
- "../../shared/Button.qml"
- "../../shared/CheckBox.qml"
- "../../shared/FlickrRssModel.qml"
- "../../shared/Label.qml"
- "../../shared/LauncherList.qml"
- "../../shared/SimpleLauncherDelegate.qml"
- "../../shared/Slider.qml"
- "../../shared/TabSet.qml"
- "../../shared/TextField.qml"
- "../../shared/images/back.png"
- "../../shared/images/checkmark.png"
- "../../shared/images/next.png"
- "../../shared/images/qt-logo.png"
- "../../shared/images/slider_handle.png"
- "../../shared/images/tab.png"
-)
-
-qt6_add_resources(affectors "shared"
- PREFIX
- "/shared"
- BASE
- "../../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS affectors
+install(TARGETS affectorsexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
+
+bundle_shared(affectorsexample)
diff --git a/examples/quick/particles/affectors/content/GreyButton.qml b/examples/quick/particles/affectors/GreyButton.qml
index d78d913cf0..d78d913cf0 100644
--- a/examples/quick/particles/affectors/content/GreyButton.qml
+++ b/examples/quick/particles/affectors/GreyButton.qml
diff --git a/examples/quick/particles/affectors/affectors.pro b/examples/quick/particles/affectors/affectors.pro
index 673ccfbb81..fc049c21b0 100644
--- a/examples/quick/particles/affectors/affectors.pro
+++ b/examples/quick/particles/affectors/affectors.pro
@@ -4,7 +4,6 @@ QT += quick qml
SOURCES += main.cpp
RESOURCES += \
affectors.qrc \
- ../images.qrc \
../../shared/shared.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/affectors
diff --git a/examples/quick/particles/affectors/affectors.qml b/examples/quick/particles/affectors/affectors.qml
index 81240fed9b..9fa067713e 100644
--- a/examples/quick/particles/affectors/affectors.qml
+++ b/examples/quick/particles/affectors/affectors.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,26 +48,26 @@
**
****************************************************************************/
-import QtQuick 2.0
-import "../../shared" as Examples
+import QtQuick
+import shared
Item {
height: 480
width: 320
- Examples.LauncherList {
+ LauncherList {
id: ll
anchors.fill: parent
Component.onCompleted: {
- addExample("Age", "Kills off particles that enter the affector", Qt.resolvedUrl("content/age.qml"));
- addExample("Attractor", "Simulates a small black hole", Qt.resolvedUrl("content/attractor.qml"));
- addExample("Custom Affector", "Custom falling leaves", Qt.resolvedUrl("content/customaffector.qml"));
- addExample("Friction", "Leaves that slow down as they fall", Qt.resolvedUrl("content/friction.qml"));
- addExample("Gravity", "Leaves that fall towards the earth as you move it", Qt.resolvedUrl("content/gravity.qml"));
- addExample("GroupGoal", "Balls that can be set on fire various ways", Qt.resolvedUrl("content/groupgoal.qml"));
- addExample("Move", "Some effects you can get by altering trajectory midway", Qt.resolvedUrl("content/move.qml"));
- addExample("SpriteGoal", "A ship that makes asteroids explode", Qt.resolvedUrl("content/spritegoal.qml"));
- addExample("Turbulence", "A candle with faint wind", Qt.resolvedUrl("content/turbulence.qml"));
- addExample("Wander", "Drifting snow flakes", Qt.resolvedUrl("content/wander.qml"));
+ addExample("Age", "Kills off particles that enter the affector", Qt.resolvedUrl("age.qml"));
+ addExample("Attractor", "Simulates a small black hole", Qt.resolvedUrl("attractor.qml"));
+ addExample("Custom Affector", "Custom falling leaves", Qt.resolvedUrl("customaffector.qml"));
+ addExample("Friction", "Leaves that slow down as they fall", Qt.resolvedUrl("friction.qml"));
+ addExample("Gravity", "Leaves that fall towards the earth as you move it", Qt.resolvedUrl("gravity.qml"));
+ addExample("GroupGoal", "Balls that can be set on fire various ways", Qt.resolvedUrl("groupgoal.qml"));
+ addExample("Move", "Some effects you can get by altering trajectory midway", Qt.resolvedUrl("move.qml"));
+ addExample("SpriteGoal", "A ship that makes asteroids explode", Qt.resolvedUrl("spritegoal.qml"));
+ addExample("Turbulence", "A candle with faint wind", Qt.resolvedUrl("turbulence.qml"));
+ addExample("Wander", "Drifting snow flakes", Qt.resolvedUrl("wander.qml"));
}
}
}
diff --git a/examples/quick/particles/affectors/affectors.qrc b/examples/quick/particles/affectors/affectors.qrc
index c1d797e4d8..e26bf0b173 100644
--- a/examples/quick/particles/affectors/affectors.qrc
+++ b/examples/quick/particles/affectors/affectors.qrc
@@ -1,16 +1,31 @@
<RCC>
- <qresource prefix="/particles/affectors">
+ <qresource prefix="/affectors">
<file>affectors.qml</file>
- <file>content/age.qml</file>
- <file>content/attractor.qml</file>
- <file>content/customaffector.qml</file>
- <file>content/friction.qml</file>
- <file>content/gravity.qml</file>
- <file>content/GreyButton.qml</file>
- <file>content/groupgoal.qml</file>
- <file>content/move.qml</file>
- <file>content/spritegoal.qml</file>
- <file>content/turbulence.qml</file>
- <file>content/wander.qml</file>
+ <file>age.qml</file>
+ <file>attractor.qml</file>
+ <file>customaffector.qml</file>
+ <file>friction.qml</file>
+ <file>gravity.qml</file>
+ <file>GreyButton.qml</file>
+ <file>groupgoal.qml</file>
+ <file>move.qml</file>
+ <file>spritegoal.qml</file>
+ <file>turbulence.qml</file>
+ <file>wander.qml</file>
+ <file>images/snowflake.png</file>
+ <file>images/finalfrontier.png</file>
+ <file>images/meteor.png</file>
+ <file>images/rocket.png</file>
+ <file>images/rocket2.png</file>
+ <file>images/backgroundLeaves.jpg</file>
+ <file>images/realLeaf1.png</file>
+ <file>images/realLeaf2.png</file>
+ <file>images/realLeaf3.png</file>
+ <file>images/realLeaf4.png</file>
+ <file>images/particleA.png</file>
+ <file>images/matchmask.png</file>
+ <file>images/nullRock.png</file>
+ <file>images/_explo.png</file>
+ <file>images/candle.png</file>
</qresource>
</RCC>
diff --git a/examples/quick/particles/affectors/content/age.qml b/examples/quick/particles/affectors/age.qml
index ff5114a596..a787563506 100644
--- a/examples/quick/particles/affectors/content/age.qml
+++ b/examples/quick/particles/affectors/age.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
@@ -63,7 +63,7 @@ Rectangle {
system: particles
sprites: Sprite {
name: "snow"
- source: "../../images/snowflake.png"
+ source: "images/snowflake.png"
frameCount: 51
frameDuration: 40
frameDurationVariation: 8
diff --git a/examples/quick/particles/affectors/content/attractor.qml b/examples/quick/particles/affectors/attractor.qml
index 7fbb6069b2..41055e3629 100644
--- a/examples/quick/particles/affectors/content/attractor.qml
+++ b/examples/quick/particles/affectors/attractor.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
@@ -57,7 +57,7 @@ Rectangle {
height: 540
color: "black"
Image {
- source: "../../images/finalfrontier.png"
+ source: "images/finalfrontier.png"
anchors.centerIn:parent
}
ParticleSystem {
@@ -98,7 +98,7 @@ Rectangle {
sprites: Sprite {
id: spinState
name: "spinning"
- source: "../../images/meteor.png"
+ source: "images/meteor.png"
frameCount: 35
frameDuration: 60
}
@@ -156,7 +156,7 @@ Rectangle {
}
Image {
- source:"../../images/rocket2.png"
+ source:"images/rocket2.png"
id: ship
width: 45
height: 22
diff --git a/examples/quick/particles/affectors/content/customaffector.qml b/examples/quick/particles/affectors/customaffector.qml
index 76fc4dc302..ea26b2de84 100644
--- a/examples/quick/particles/affectors/content/customaffector.qml
+++ b/examples/quick/particles/affectors/customaffector.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,15 +48,15 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Item {
width: 360
height: 600
Image {
- source: "../../images/backgroundLeaves.jpg"
+ source: "images/backgroundLeaves.jpg"
anchors.fill: parent
}
ParticleSystem {
@@ -120,31 +120,31 @@ Item {
anchors.fill: parent
id: particles
sprites: [Sprite {
- source: "../../images/realLeaf1.png"
+ source: "images/realLeaf1.png"
frameCount: 1
frameDuration: 1
to: {"a":1, "b":1, "c":1, "d":1}
}, Sprite {
name: "a"
- source: "../../images/realLeaf1.png"
+ source: "images/realLeaf1.png"
frameCount: 1
frameDuration: 10000
},
Sprite {
name: "b"
- source: "../../images/realLeaf2.png"
+ source: "images/realLeaf2.png"
frameCount: 1
frameDuration: 10000
},
Sprite {
name: "c"
- source: "../../images/realLeaf3.png"
+ source: "images/realLeaf3.png"
frameCount: 1
frameDuration: 10000
},
Sprite {
name: "d"
- source: "../../images/realLeaf4.png"
+ source: "images/realLeaf4.png"
frameCount: 1
frameDuration: 10000
}
diff --git a/examples/quick/particles/affectors/doc/src/affectors.qdoc b/examples/quick/particles/affectors/doc/src/affectors.qdoc
index 9857a86241..c3469fd957 100644
--- a/examples/quick/particles/affectors/doc/src/affectors.qdoc
+++ b/examples/quick/particles/affectors/doc/src/affectors.qdoc
@@ -35,7 +35,7 @@
Each example is a small QML file emphasizing a particular type or feature.
Age demonstrates using an Age affector to prematurely end the lives of particles.
- \snippet particles/affectors/content/age.qml 0
+ \snippet particles/affectors/age.qml 0
As you move the affector around the screen, the particles inside it
(which haven't already been affected) jump to a period near the end
@@ -44,7 +44,7 @@
the end of their life instantly.
Attractor demonstrates using an Attractor affector to simulate a black hole
- \snippet particles/affectors/content/attractor.qml 0
+ \snippet particles/affectors/attractor.qml 0
All particles in the scene, including the rocket ship's exhaust and pellets, are pulled
towards the black hole. This effect is stronger closer to the black hole, so the
@@ -55,58 +55,58 @@
Custom Affector manipulates the properties of the particles directly in javascript.
One Affector is used to make the leaves rock back and forth as they fall, looking more
leaf-like than just spinning in circles:
- \snippet particles/affectors/content/customaffector.qml 0
+ \snippet particles/affectors/customaffector.qml 0
Another is used to provide a slightly varying friction to the leaves as they 'land',
to look more natural:
- \snippet particles/affectors/content/customaffector.qml 1
+ \snippet particles/affectors/customaffector.qml 1
Friction is similar to the falling leaves in the custom affector, except that it uses a
flat friction the whole way down instead of custom affectors.
- \snippet particles/affectors/content/friction.qml 0
+ \snippet particles/affectors/friction.qml 0
Gravity is a convenience affector for applying a constant acceleration to particles inside it
- \snippet particles/affectors/content/gravity.qml 0
+ \snippet particles/affectors/gravity.qml 0
GroupGoal sets up two particle groups for flaming and non-flaming balls, and gives you various
ways to transition between them.
- \snippet particles/affectors/content/groupgoal.qml unlit
+ \snippet particles/affectors/groupgoal.qml unlit
The non-flaming balls have a one in a hundred chance of lighting on their own each second, but they also
have a GroupGoal set on the whole group. This affector affects all particles of the unlit group, when colliding
with particles in the lit group, and cause them to move to the lighting group.
- \snippet particles/affectors/content/groupgoal.qml lighting
+ \snippet particles/affectors/groupgoal.qml lighting
lighting is an intermediate group so that the glow builds up and the transition is less jarring. So it automatically
moves into the lit group after 100ms.
- \snippet particles/affectors/content/groupgoal.qml lit
+ \snippet particles/affectors/groupgoal.qml lit
The lit group also has TrailEmitters on it for additional fire and smoke, but does not transition anywhere.
There are two more GroupGoal objects that allow particles in the unlit group to transition to the lighting group
(and then to the lit group).
- \snippet particles/affectors/content/groupgoal.qml groupgoal-pilot
+ \snippet particles/affectors/groupgoal.qml groupgoal-pilot
The first is just an area bound to the location of an image of a pilot flame. When unlit balls pass through the flame,
they go straight to lit because the pilot flame is so hot.
- \snippet particles/affectors/content/groupgoal.qml groupgoal-ma
+ \snippet particles/affectors/groupgoal.qml groupgoal-ma
The second is bound to the location of the last pointer interaction, so that touching or clicking on unlit balls (which
is hard due to their constant movement) causes them to move to the lighting group.
Move shows some simple effects you can get by altering trajectory midway.
The red particles have an affector that affects their position, jumping them forwards by 120px.
- \snippet particles/affectors/content/move.qml A
+ \snippet particles/affectors/move.qml A
The green particles have an affector that affects their velocity, but with some angle variation. By adding some random direction
velocity to their existing forwards velocity, they begin to spray off in a cone.
- \snippet particles/affectors/content/move.qml B
+ \snippet particles/affectors/move.qml B
The blue particles have an affector that affects their acceleration, and because it sets relative to false this resets the acceleration instead of
adding to it. Once the blue particles reach the affector, their horizontal velocity stops increasing as their vertical velocity decreases.
- \snippet particles/affectors/content/move.qml C
+ \snippet particles/affectors/move.qml C
SpriteGoal has an affector which interacts with the sprite engine of particles, if they are being drawn as sprites by ImageParticle.
- \snippet particles/affectors/content/spritegoal.qml 0
+ \snippet particles/affectors/spritegoal.qml 0
The SpriteGoal follows the image of the rocket ship on screen, and when it interacts with particles drawn by ImageParticle as sprites,
it instructs them to move immediately to the "explode" state, which in this case is the animation of the asteroid breaking into many pieces.
Turbulence has a flame with smoke, and both sets of particles being affected by a Turbulence affector. This gives a faint wind effect.
- \snippet particles/affectors/content/turbulence.qml 0
+ \snippet particles/affectors/turbulence.qml 0
To make the wind change direction, subsitute a black and white noise image in the noiseSource parameter (it currently uses a default noise source).
Wander uses a Wander affector to add some horizontal drift to snowflakes as they fall down.
- \snippet particles/affectors/content/wander.qml 0
+ \snippet particles/affectors/wander.qml 0
There are different movements given by applying the Wander to different attributes of the trajectory, so the example makes it easy to play around and see the difference.
*/
diff --git a/examples/quick/particles/affectors/content/friction.qml b/examples/quick/particles/affectors/friction.qml
index 1fa85ec2fe..aa2d1c72d7 100644
--- a/examples/quick/particles/affectors/content/friction.qml
+++ b/examples/quick/particles/affectors/friction.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,15 +48,15 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Item {
width: 360
height: 600
Image {
- source: "../../images/backgroundLeaves.jpg"
+ source: "images/backgroundLeaves.jpg"
anchors.fill: parent
}
ParticleSystem {
@@ -73,31 +73,31 @@ Item {
anchors.fill: parent
id: particles
sprites: [Sprite {
- source: "../../images/realLeaf1.png"
+ source: "images/realLeaf1.png"
frameCount: 1
frameDuration: 1
to: {"a":1, "b":1, "c":1, "d":1}
}, Sprite {
name: "a"
- source: "../../images/realLeaf1.png"
+ source: "images/realLeaf1.png"
frameCount: 1
frameDuration: 10000
},
Sprite {
name: "b"
- source: "../../images/realLeaf2.png"
+ source: "images/realLeaf2.png"
frameCount: 1
frameDuration: 10000
},
Sprite {
name: "c"
- source: "../../images/realLeaf3.png"
+ source: "images/realLeaf3.png"
frameCount: 1
frameDuration: 10000
},
Sprite {
name: "d"
- source: "../../images/realLeaf4.png"
+ source: "images/realLeaf4.png"
frameCount: 1
frameDuration: 10000
}
diff --git a/examples/quick/particles/affectors/content/gravity.qml b/examples/quick/particles/affectors/gravity.qml
index 99b14f3b1f..cf517ae319 100644
--- a/examples/quick/particles/affectors/content/gravity.qml
+++ b/examples/quick/particles/affectors/gravity.qml
@@ -1,6 +1,6 @@
/****************************************************************************
*
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Item {
id: window
@@ -109,7 +109,7 @@ Item {
ImageParticle {
anchors.fill: parent
system: sys
- source: "../../images/realLeaf1.png"
+ source: "images/realLeaf1.png"
}
}
diff --git a/examples/quick/particles/affectors/content/groupgoal.qml b/examples/quick/particles/affectors/groupgoal.qml
index 9910531a98..27c910e69a 100644
--- a/examples/quick/particles/affectors/content/groupgoal.qml
+++ b/examples/quick/particles/affectors/groupgoal.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
@@ -74,7 +74,7 @@ Rectangle {
duration: 1000
to: {"lighting":1, "unlit":99}
ImageParticle {
- source: "../../images/particleA.png"
+ source: "images/particleA.png"
colorVariation: 0.1
color: "#2060160f"
}
@@ -151,7 +151,7 @@ Rectangle {
id: flame
anchors.fill: parent
groups: ["flame", "lit", "lighting"]
- source: "../../images/particleA.png"
+ source: "images/particleA.png"
colorVariation: 0.1
color: "#00ff400f"
}
@@ -188,7 +188,7 @@ Rectangle {
y: -55
height: 75
width: 30
- shape: MaskShape {source: "../../images/matchmask.png"}
+ shape: MaskShape {source: "images/matchmask.png"}
}
// ![groupgoal-pilot]
}
diff --git a/examples/quick/particles/images/_explo.png b/examples/quick/particles/affectors/images/_explo.png
index 4297245d49..4297245d49 100644
--- a/examples/quick/particles/images/_explo.png
+++ b/examples/quick/particles/affectors/images/_explo.png
Binary files differ
diff --git a/examples/quick/particles/images/backgroundLeaves.jpg b/examples/quick/particles/affectors/images/backgroundLeaves.jpg
index 08be16751d..08be16751d 100644
--- a/examples/quick/particles/images/backgroundLeaves.jpg
+++ b/examples/quick/particles/affectors/images/backgroundLeaves.jpg
Binary files differ
diff --git a/examples/quick/particles/images/candle.png b/examples/quick/particles/affectors/images/candle.png
index 8fa3193719..8fa3193719 100644
--- a/examples/quick/particles/images/candle.png
+++ b/examples/quick/particles/affectors/images/candle.png
Binary files differ
diff --git a/examples/quick/particles/images/finalfrontier.png b/examples/quick/particles/affectors/images/finalfrontier.png
index 2ba1815230..2ba1815230 100644
--- a/examples/quick/particles/images/finalfrontier.png
+++ b/examples/quick/particles/affectors/images/finalfrontier.png
Binary files differ
diff --git a/examples/quick/particles/images/matchmask.png b/examples/quick/particles/affectors/images/matchmask.png
index e575875c55..e575875c55 100644
--- a/examples/quick/particles/images/matchmask.png
+++ b/examples/quick/particles/affectors/images/matchmask.png
Binary files differ
diff --git a/examples/quick/particles/images/meteor.png b/examples/quick/particles/affectors/images/meteor.png
index e8c368aea7..e8c368aea7 100644
--- a/examples/quick/particles/images/meteor.png
+++ b/examples/quick/particles/affectors/images/meteor.png
Binary files differ
diff --git a/examples/quick/particles/images/nullRock.png b/examples/quick/particles/affectors/images/nullRock.png
index 4076327a1a..4076327a1a 100644
--- a/examples/quick/particles/images/nullRock.png
+++ b/examples/quick/particles/affectors/images/nullRock.png
Binary files differ
diff --git a/examples/quick/particles/images/particleA.png b/examples/quick/particles/affectors/images/particleA.png
index d86fc9696b..d86fc9696b 100644
--- a/examples/quick/particles/images/particleA.png
+++ b/examples/quick/particles/affectors/images/particleA.png
Binary files differ
diff --git a/examples/quick/particles/images/realLeaf1.png b/examples/quick/particles/affectors/images/realLeaf1.png
index 6cabf29efd..6cabf29efd 100644
--- a/examples/quick/particles/images/realLeaf1.png
+++ b/examples/quick/particles/affectors/images/realLeaf1.png
Binary files differ
diff --git a/examples/quick/particles/images/realLeaf2.png b/examples/quick/particles/affectors/images/realLeaf2.png
index bfeca861d5..bfeca861d5 100644
--- a/examples/quick/particles/images/realLeaf2.png
+++ b/examples/quick/particles/affectors/images/realLeaf2.png
Binary files differ
diff --git a/examples/quick/particles/images/realLeaf3.png b/examples/quick/particles/affectors/images/realLeaf3.png
index b1071e862b..b1071e862b 100644
--- a/examples/quick/particles/images/realLeaf3.png
+++ b/examples/quick/particles/affectors/images/realLeaf3.png
Binary files differ
diff --git a/examples/quick/particles/images/realLeaf4.png b/examples/quick/particles/affectors/images/realLeaf4.png
index d61d53d10e..d61d53d10e 100644
--- a/examples/quick/particles/images/realLeaf4.png
+++ b/examples/quick/particles/affectors/images/realLeaf4.png
Binary files differ
diff --git a/examples/quick/particles/images/rocket.png b/examples/quick/particles/affectors/images/rocket.png
index a171610b03..a171610b03 100644
--- a/examples/quick/particles/images/rocket.png
+++ b/examples/quick/particles/affectors/images/rocket.png
Binary files differ
diff --git a/examples/quick/particles/images/rocket2.png b/examples/quick/particles/affectors/images/rocket2.png
index 7110f8fdc6..7110f8fdc6 100644
--- a/examples/quick/particles/images/rocket2.png
+++ b/examples/quick/particles/affectors/images/rocket2.png
Binary files differ
diff --git a/examples/quick/particles/images/snowflake.png b/examples/quick/particles/affectors/images/snowflake.png
index 490887a82f..490887a82f 100644
--- a/examples/quick/particles/images/snowflake.png
+++ b/examples/quick/particles/affectors/images/snowflake.png
Binary files differ
diff --git a/examples/quick/particles/affectors/main.cpp b/examples/quick/particles/affectors/main.cpp
index 9e90217000..854f1d92a8 100644
--- a/examples/quick/particles/affectors/main.cpp
+++ b/examples/quick/particles/affectors/main.cpp
@@ -48,4 +48,4 @@
**
****************************************************************************/
#include "../../shared/shared.h"
-DECLARATIVE_EXAMPLE_MAIN(particles/affectors/affectors)
+DECLARATIVE_EXAMPLE_MAIN(affectors/affectors)
diff --git a/examples/quick/particles/affectors/content/move.qml b/examples/quick/particles/affectors/move.qml
index b33d7f4006..b33d7f4006 100644
--- a/examples/quick/particles/affectors/content/move.qml
+++ b/examples/quick/particles/affectors/move.qml
diff --git a/examples/quick/particles/affectors/content/spritegoal.qml b/examples/quick/particles/affectors/spritegoal.qml
index 294f693221..1ba7b46dd6 100644
--- a/examples/quick/particles/affectors/content/spritegoal.qml
+++ b/examples/quick/particles/affectors/spritegoal.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Item {
id: root
@@ -62,7 +62,7 @@ Item {
ParticleSystem { id: sys }
Image {
- source: "../../images/finalfrontier.png"
+ source: "images/finalfrontier.png"
transformOrigin: Item.Center
anchors.centerIn: parent
NumberAnimation on rotation {
@@ -113,20 +113,20 @@ Item {
sprites:[Sprite {
id: spinState
name: "spinning"
- source: "../../images/meteor.png"
+ source: "images/meteor.png"
frameCount: 35
frameDuration: 40
randomStart: true
to: {"explode":0, "spinning":1}
},Sprite {
name: "explode"
- source: "../../images/_explo.png"
+ source: "images/_explo.png"
frameCount: 22
frameDuration: 40
to: {"nullFrame":1}
},Sprite {//Not sure if this is needed, but seemed easiest
name: "nullFrame"
- source: "../../images/nullRock.png"
+ source: "images/nullRock.png"
frameCount: 1
frameDuration: 1000
}
@@ -145,7 +145,7 @@ Item {
//! [0]
Image {
id: rocketShip
- source: "../../images/rocket.png"
+ source: "images/rocket.png"
anchors.centerIn: holder
rotation: (circle.percent+0.25) * 360
z: 2
diff --git a/examples/quick/particles/affectors/content/turbulence.qml b/examples/quick/particles/affectors/turbulence.qml
index e58b3ede7f..83c2b1744f 100644
--- a/examples/quick/particles/affectors/content/turbulence.qml
+++ b/examples/quick/particles/affectors/turbulence.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
width: 320
@@ -57,7 +57,7 @@ Rectangle {
color: "#222222"
id: root
Image {
- source: "../../images/candle.png"
+ source: "images/candle.png"
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: -60
diff --git a/examples/quick/particles/affectors/content/wander.qml b/examples/quick/particles/affectors/wander.qml
index 736fc1af76..613298eb4f 100644
--- a/examples/quick/particles/affectors/content/wander.qml
+++ b/examples/quick/particles/affectors/wander.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
width: 360
@@ -59,7 +59,7 @@ Rectangle {
system: particles
sprites: Sprite {
name: "snow"
- source: "../../images/snowflake.png"
+ source: "images/snowflake.png"
frameCount: 51
frameDuration: 40
frameDurationVariation: 8
diff --git a/examples/quick/particles/emitters/CMakeLists.txt b/examples/quick/particles/emitters/CMakeLists.txt
index 9c71351ed3..bf68c59cf5 100644
--- a/examples/quick/particles/emitters/CMakeLists.txt
+++ b/examples/quick/particles/emitters/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from emitters.pro.
-
cmake_minimum_required(VERSION 3.16)
project(emitters LANGUAGES CXX)
@@ -7,7 +5,6 @@ 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")
@@ -15,115 +12,44 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/emitters")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
+find_package(Qt6 COMPONENTS Core Gui Quick Qml)
+
+add_subdirectory("../../shared" "shared")
-qt_add_executable(emitters
+qt_add_executable(emittersexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(emitters PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(emitters PUBLIC
+target_link_libraries(emittersexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
)
+add_dependencies(emittersexample emitters_shared)
# Resources:
-set(emitters_resource_files
- "content/burstandpulse.qml"
- "content/customemitter.qml"
- "content/emitmask.qml"
- "content/maximumemitted.qml"
- "content/shapeanddirection.qml"
- "content/trailemitter.qml"
- "content/velocityfrommotion.qml"
- "emitters.qml"
-)
-
-qt6_add_resources(emitters "emitters"
- PREFIX
- "/particles/emitters"
- FILES
- ${emitters_resource_files}
-)
-set(images_resource_files
- "../images/_explo.png"
- "../images/backgroundLeaves.jpg"
- "../images/bear_tiles.png"
- "../images/candle.png"
- "../images/colortable.png"
- "../images/finalfrontier.png"
- "../images/flower.png"
- "../images/matchmask.png"
- "../images/meteor.png"
- "../images/meteor_explo.png"
- "../images/meteors.png"
- "../images/nullRock.png"
- "../images/particle2.png"
- "../images/particle3.png"
- "../images/particleA.png"
- "../images/portal_bg.png"
- "../images/realLeaf1.png"
- "../images/realLeaf2.png"
- "../images/realLeaf3.png"
- "../images/realLeaf4.png"
- "../images/rocket.png"
- "../images/rocket2.png"
- "../images/sizeInOut.png"
- "../images/snowflake.png"
- "../images/sparkleSize.png"
- "../images/starfish_0.png"
- "../images/starfish_1.png"
- "../images/starfish_2.png"
- "../images/starfish_3.png"
- "../images/starfish_4.png"
- "../images/starfish_mask.png"
-)
-
-qt6_add_resources(emitters "images"
- PREFIX
- "/particles"
- BASE
- ".."
- FILES
- ${images_resource_files}
-)
-set(shared_resource_files
- "../../shared/Button.qml"
- "../../shared/CheckBox.qml"
- "../../shared/FlickrRssModel.qml"
- "../../shared/Label.qml"
- "../../shared/LauncherList.qml"
- "../../shared/SimpleLauncherDelegate.qml"
- "../../shared/Slider.qml"
- "../../shared/TabSet.qml"
- "../../shared/TextField.qml"
- "../../shared/images/back.png"
- "../../shared/images/checkmark.png"
- "../../shared/images/next.png"
- "../../shared/images/qt-logo.png"
- "../../shared/images/slider_handle.png"
- "../../shared/images/tab.png"
-)
-
-qt6_add_resources(emitters "shared"
- PREFIX
- "/shared"
- BASE
- "../../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS emitters
+qt_add_qml_module(emittersexample
+ URI emitters
+ VERSION 1.0
+ QML_FILES
+ "burstandpulse.qml"
+ "customemitter.qml"
+ "emitmask.qml"
+ "maximumemitted.qml"
+ "shapeanddirection.qml"
+ "trailemitter.qml"
+ "velocityfrommotion.qml"
+ "emitters.qml"
+ RESOURCES
+ "images/portal_bg.png"
+ "images/starfish_mask.png"
+)
+
+install(TARGETS emittersexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
+
+bundle_shared(emittersexample)
diff --git a/examples/quick/particles/emitters/content/burstandpulse.qml b/examples/quick/particles/emitters/burstandpulse.qml
index d3c38c2360..d3c38c2360 100644
--- a/examples/quick/particles/emitters/content/burstandpulse.qml
+++ b/examples/quick/particles/emitters/burstandpulse.qml
diff --git a/examples/quick/particles/emitters/content/customemitter.qml b/examples/quick/particles/emitters/customemitter.qml
index f6aea13d08..f6aea13d08 100644
--- a/examples/quick/particles/emitters/content/customemitter.qml
+++ b/examples/quick/particles/emitters/customemitter.qml
diff --git a/examples/quick/particles/emitters/doc/src/emitters.qdoc b/examples/quick/particles/emitters/doc/src/emitters.qdoc
index 2ba7ceb0b9..a00ae280b8 100644
--- a/examples/quick/particles/emitters/doc/src/emitters.qdoc
+++ b/examples/quick/particles/emitters/doc/src/emitters.qdoc
@@ -34,27 +34,27 @@
Each example is a small QML file emphasizing a particular type or feature.
Velocity from motion gives the effect of strong particle motion through primarily moving the emitters:
- \snippet particles/emitters/content/velocityfrommotion.qml 0
+ \snippet particles/emitters/velocityfrommotion.qml 0
Burst and pulse calls the burst and pulse methods on two idential emitters.
- \snippet particles/emitters/content/burstandpulse.qml 0
+ \snippet particles/emitters/burstandpulse.qml 0
Note how burst takes an argument of number of particles to emit, and pulse takes an argument of number of milliseconds to emit for.
This gives a slightly different behaviour, which is easy to see in this example.
Custom Emitter connects to the emitParticles signal to set arbitrary values on particle data as they're emitted;
- \snippet particles/emitters/content/customemitter.qml 0
+ \snippet particles/emitters/customemitter.qml 0
This is used to emit curving particles in six rotating spokes.
Emit mask sets an image mask on the Emitter, to emit out of an arbitrary shape.
- \snippet particles/emitters/content/emitmask.qml 0
+ \snippet particles/emitters/emitmask.qml 0
Maximum emitted emits no more than a certain number of particles at a time. This example makes it easy to see what happens when the limit is reached.
Shape and Direction emits particles out of an unfilled Ellipse shape, using a TargetDirection
- \snippet particles/emitters/content/shapeanddirection.qml 0
+ \snippet particles/emitters/shapeanddirection.qml 0
This sends the particles towards the center of the ellipse with proportional speed, keeping the ellipse outline as they move to the center.
TrailEmitter uses that type to add smoke particles to trail the fire particles in the scene.
- \snippet particles/emitters/content/customemitter.qml 0
+ \snippet particles/emitters/customemitter.qml 0
*/
diff --git a/examples/quick/particles/emitters/content/emitmask.qml b/examples/quick/particles/emitters/emitmask.qml
index db13480e29..00fe9e6310 100644
--- a/examples/quick/particles/emitters/content/emitmask.qml
+++ b/examples/quick/particles/emitters/emitmask.qml
@@ -75,7 +75,7 @@ Rectangle {
size: 10
//! [0]
shape: MaskShape {
- source: "../../images/starfish_mask.png"
+ source: "images/starfish_mask.png"
}
//! [0]
}
diff --git a/examples/quick/particles/emitters/emitters.pro b/examples/quick/particles/emitters/emitters.pro
index c5d8b8b0c9..e493bc6a72 100644
--- a/examples/quick/particles/emitters/emitters.pro
+++ b/examples/quick/particles/emitters/emitters.pro
@@ -4,7 +4,6 @@ QT += quick qml
SOURCES += main.cpp
RESOURCES += \
emitters.qrc \
- ../images.qrc \
../../shared/shared.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/emitters
diff --git a/examples/quick/particles/emitters/emitters.qml b/examples/quick/particles/emitters/emitters.qml
index 83b9eacc7c..c884ec2341 100644
--- a/examples/quick/particles/emitters/emitters.qml
+++ b/examples/quick/particles/emitters/emitters.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,23 +48,23 @@
**
****************************************************************************/
-import QtQuick 2.0
-import "../../shared" as Examples
+import QtQuick
+import shared
Item {
height: 480
width: 320
- Examples.LauncherList {
+ LauncherList {
id: ll
anchors.fill: parent
Component.onCompleted: {
- addExample("Velocity from Motion", "Particle motion just by moving emitters", Qt.resolvedUrl("content/velocityfrommotion.qml"));
- addExample("Burst and Pulse", "Emit imperatively", Qt.resolvedUrl("content/burstandpulse.qml"));
- addExample("Custom Emitter", "Custom starting state", Qt.resolvedUrl("content/customemitter.qml"));
- addExample("Emit Mask", "Emit arbitrary shapes", Qt.resolvedUrl("content/emitmask.qml"));
- addExample("Maximum Emitted", "Put a limit on emissions", Qt.resolvedUrl("content/maximumemitted.qml"));
- addExample("Shape and Direction", "Creates a portal effect", Qt.resolvedUrl("content/shapeanddirection.qml"));
- addExample("TrailEmitter", "Emit from other particles", Qt.resolvedUrl("content/trailemitter.qml"));
+ addExample("Velocity from Motion", "Particle motion just by moving emitters", Qt.resolvedUrl("velocityfrommotion.qml"));
+ addExample("Burst and Pulse", "Emit imperatively", Qt.resolvedUrl("burstandpulse.qml"));
+ addExample("Custom Emitter", "Custom starting state", Qt.resolvedUrl("customemitter.qml"));
+ addExample("Emit Mask", "Emit arbitrary shapes", Qt.resolvedUrl("emitmask.qml"));
+ addExample("Maximum Emitted", "Put a limit on emissions", Qt.resolvedUrl("maximumemitted.qml"));
+ addExample("Shape and Direction", "Creates a portal effect", Qt.resolvedUrl("shapeanddirection.qml"));
+ addExample("TrailEmitter", "Emit from other particles", Qt.resolvedUrl("trailemitter.qml"));
}
}
}
diff --git a/examples/quick/particles/emitters/emitters.qrc b/examples/quick/particles/emitters/emitters.qrc
index 708c8683f0..5eaf30cb04 100644
--- a/examples/quick/particles/emitters/emitters.qrc
+++ b/examples/quick/particles/emitters/emitters.qrc
@@ -1,12 +1,14 @@
<RCC>
- <qresource prefix="/particles/emitters">
+ <qresource prefix="/emitters">
<file>emitters.qml</file>
- <file>content/burstandpulse.qml</file>
- <file>content/customemitter.qml</file>
- <file>content/emitmask.qml</file>
- <file>content/maximumemitted.qml</file>
- <file>content/shapeanddirection.qml</file>
- <file>content/trailemitter.qml</file>
- <file>content/velocityfrommotion.qml</file>
+ <file>burstandpulse.qml</file>
+ <file>customemitter.qml</file>
+ <file>emitmask.qml</file>
+ <file>maximumemitted.qml</file>
+ <file>shapeanddirection.qml</file>
+ <file>trailemitter.qml</file>
+ <file>velocityfrommotion.qml</file>
+ <file>images/starfish_mask.png</file>
+ <file>images/portal_bg.png</file>
</qresource>
</RCC>
diff --git a/examples/quick/particles/images/portal_bg.png b/examples/quick/particles/emitters/images/portal_bg.png
index 3c59eeabb9..3c59eeabb9 100644
--- a/examples/quick/particles/images/portal_bg.png
+++ b/examples/quick/particles/emitters/images/portal_bg.png
Binary files differ
diff --git a/examples/quick/particles/images/starfish_mask.png b/examples/quick/particles/emitters/images/starfish_mask.png
index 7ae39b34c5..7ae39b34c5 100644
--- a/examples/quick/particles/images/starfish_mask.png
+++ b/examples/quick/particles/emitters/images/starfish_mask.png
Binary files differ
diff --git a/examples/quick/particles/emitters/main.cpp b/examples/quick/particles/emitters/main.cpp
index e2b3cf2026..1d35645e63 100644
--- a/examples/quick/particles/emitters/main.cpp
+++ b/examples/quick/particles/emitters/main.cpp
@@ -48,4 +48,4 @@
**
****************************************************************************/
#include "../../shared/shared.h"
-DECLARATIVE_EXAMPLE_MAIN(particles/emitters/emitters)
+DECLARATIVE_EXAMPLE_MAIN(emitters/emitters)
diff --git a/examples/quick/particles/emitters/content/maximumemitted.qml b/examples/quick/particles/emitters/maximumemitted.qml
index dd4dfdfbdd..dd4dfdfbdd 100644
--- a/examples/quick/particles/emitters/content/maximumemitted.qml
+++ b/examples/quick/particles/emitters/maximumemitted.qml
diff --git a/examples/quick/particles/emitters/content/shapeanddirection.qml b/examples/quick/particles/emitters/shapeanddirection.qml
index 8d1659b099..cffec4196b 100644
--- a/examples/quick/particles/emitters/content/shapeanddirection.qml
+++ b/examples/quick/particles/emitters/shapeanddirection.qml
@@ -58,7 +58,7 @@ Rectangle {
color: "black"
Image {
anchors.fill: parent
- source: "../../images/portal_bg.png"
+ source: "images/portal_bg.png"
}
ParticleSystem {
diff --git a/examples/quick/particles/emitters/content/trailemitter.qml b/examples/quick/particles/emitters/trailemitter.qml
index fdb6180eb6..fdb6180eb6 100644
--- a/examples/quick/particles/emitters/content/trailemitter.qml
+++ b/examples/quick/particles/emitters/trailemitter.qml
diff --git a/examples/quick/particles/emitters/content/velocityfrommotion.qml b/examples/quick/particles/emitters/velocityfrommotion.qml
index eee533a2fe..eee533a2fe 100644
--- a/examples/quick/particles/emitters/content/velocityfrommotion.qml
+++ b/examples/quick/particles/emitters/velocityfrommotion.qml
diff --git a/examples/quick/particles/imageparticle/CMakeLists.txt b/examples/quick/particles/imageparticle/CMakeLists.txt
index 4487e04316..387c5bdd41 100644
--- a/examples/quick/particles/imageparticle/CMakeLists.txt
+++ b/examples/quick/particles/imageparticle/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from imageparticle.pro.
-
cmake_minimum_required(VERSION 3.16)
project(imageparticle LANGUAGES CXX)
@@ -7,7 +5,6 @@ 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")
@@ -15,115 +12,50 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/imageparticle")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
+find_package(Qt6 COMPONENTS Core Gui Quick Qml)
+
+add_subdirectory("../../shared" "shared")
-qt_add_executable(imageparticle
+qt_add_executable(imageparticleexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(imageparticle PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(imageparticle PUBLIC
+target_link_libraries(imageparticleexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
)
+add_dependencies(imageparticleexample imageparticle_shared)
# Resources:
-set(imageparticle_resource_files
- "content/allatonce.qml"
- "content/colored.qml"
- "content/colortable.qml"
- "content/deformation.qml"
- "content/rotation.qml"
- "content/sharing.qml"
- "content/sprites.qml"
- "imageparticle.qml"
-)
-
-qt6_add_resources(imageparticle "imageparticle"
- PREFIX
- "/particles/imageparticle"
- FILES
- ${imageparticle_resource_files}
-)
-set(images_resource_files
- "../images/_explo.png"
- "../images/backgroundLeaves.jpg"
- "../images/bear_tiles.png"
- "../images/candle.png"
- "../images/colortable.png"
- "../images/finalfrontier.png"
- "../images/flower.png"
- "../images/matchmask.png"
- "../images/meteor.png"
- "../images/meteor_explo.png"
- "../images/meteors.png"
- "../images/nullRock.png"
- "../images/particle2.png"
- "../images/particle3.png"
- "../images/particleA.png"
- "../images/portal_bg.png"
- "../images/realLeaf1.png"
- "../images/realLeaf2.png"
- "../images/realLeaf3.png"
- "../images/realLeaf4.png"
- "../images/rocket.png"
- "../images/rocket2.png"
- "../images/sizeInOut.png"
- "../images/snowflake.png"
- "../images/sparkleSize.png"
- "../images/starfish_0.png"
- "../images/starfish_1.png"
- "../images/starfish_2.png"
- "../images/starfish_3.png"
- "../images/starfish_4.png"
- "../images/starfish_mask.png"
-)
-
-qt6_add_resources(imageparticle "images"
- PREFIX
- "/particles"
- BASE
- ".."
- FILES
- ${images_resource_files}
-)
-set(shared_resource_files
- "../../shared/Button.qml"
- "../../shared/CheckBox.qml"
- "../../shared/FlickrRssModel.qml"
- "../../shared/Label.qml"
- "../../shared/LauncherList.qml"
- "../../shared/SimpleLauncherDelegate.qml"
- "../../shared/Slider.qml"
- "../../shared/TabSet.qml"
- "../../shared/TextField.qml"
- "../../shared/images/back.png"
- "../../shared/images/checkmark.png"
- "../../shared/images/next.png"
- "../../shared/images/qt-logo.png"
- "../../shared/images/slider_handle.png"
- "../../shared/images/tab.png"
-)
-
-qt6_add_resources(imageparticle "shared"
- PREFIX
- "/shared"
- BASE
- "../../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS imageparticle
+qt_add_qml_module(imageparticleexample
+ URI imageparticle
+ VERSION 1.0
+ QML_FILES
+ "allatonce.qml"
+ "colored.qml"
+ "colortable.qml"
+ "deformation.qml"
+ "imageparticle.qml"
+ "rotation.qml"
+ "sharing.qml"
+ "sprites.qml"
+ RESOURCES
+ "images/bear_tiles.png"
+ "images/colortable.png"
+ "images/starfish_0.png"
+ "images/starfish_1.png"
+ "images/starfish_2.png"
+ "images/starfish_3.png"
+ "images/starfish_4.png"
+ "images/flower.png"
+)
+
+install(TARGETS imageparticleexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
+
+bundle_shared(imageparticleexample)
diff --git a/examples/quick/particles/imageparticle/content/allatonce.qml b/examples/quick/particles/imageparticle/allatonce.qml
index 4b6c9b35cc..5a250bc79a 100644
--- a/examples/quick/particles/imageparticle/content/allatonce.qml
+++ b/examples/quick/particles/imageparticle/allatonce.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
color: "white"
@@ -64,14 +64,14 @@ Rectangle {
sprites: [
Sprite {
name: "bear"
- source: "../../images/bear_tiles.png"
+ source: "images/bear_tiles.png"
frameCount: 13
frameDuration: 120
}
]
colorVariation: 0.5
rotationVelocityVariation: 360
- colorTable: "../../images/colortable.png"
+ colorTable: "images/colortable.png"
// ![0]
system: sys
}
diff --git a/examples/quick/particles/imageparticle/content/colored.qml b/examples/quick/particles/imageparticle/colored.qml
index 3452cad805..11c4304457 100644
--- a/examples/quick/particles/imageparticle/content/colored.qml
+++ b/examples/quick/particles/imageparticle/colored.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
width: 360
diff --git a/examples/quick/particles/imageparticle/content/colortable.qml b/examples/quick/particles/imageparticle/colortable.qml
index 5f88c1a8b3..809ad345f9 100644
--- a/examples/quick/particles/imageparticle/content/colortable.qml
+++ b/examples/quick/particles/imageparticle/colortable.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick.Particles 2.0
-import QtQuick 2.0
+import QtQuick.Particles
+import QtQuick
Rectangle {
id: root
@@ -66,8 +66,8 @@ Rectangle {
//! [0]
source: "qrc:///particleresources/glowdot.png"
- colorTable: "../../images/colortable.png"
- sizeTable: "../../images/colortable.png"
+ colorTable: "images/colortable.png"
+ sizeTable: "images/colortable.png"
//! [0]
}
diff --git a/examples/quick/particles/imageparticle/content/deformation.qml b/examples/quick/particles/imageparticle/deformation.qml
index ce672c8fa3..f8f0f31e33 100644
--- a/examples/quick/particles/imageparticle/content/deformation.qml
+++ b/examples/quick/particles/imageparticle/deformation.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
color: "goldenrod"
@@ -61,7 +61,7 @@ Rectangle {
ImageParticle {
system: sys
groups: ["goingLeft", "goingRight"]
- source: "../../images/starfish_4.png"
+ source: "images/starfish_4.png"
rotation: 90
rotationVelocity: 90
autoRotation: true
@@ -71,7 +71,7 @@ Rectangle {
ImageParticle {
system: sys
groups: ["goingDown"]
- source: "../../images/starfish_0.png"
+ source: "images/starfish_0.png"
rotation: 180
yVector: PointDirection { y: 0.5; yVariation: 0.25; xVariation: 0.25; }
}
diff --git a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc
index 6a71e1f5fd..9ef3228126 100644
--- a/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc
+++ b/examples/quick/particles/imageparticle/doc/src/imageparticle.qdoc
@@ -35,25 +35,25 @@
Each example is a small QML file emphasizing a particular type or feature.
All at once shows off several of the features of ImageParticle at the same time.
- \snippet particles/imageparticle/content/allatonce.qml 0
+ \snippet particles/imageparticle/allatonce.qml 0
Colored shows a simple ImageParticle with some color variation.
- \snippet particles/imageparticle/content/colored.qml 0
+ \snippet particles/imageparticle/colored.qml 0
Color Table sets the color over life on the particles to provide a fixed rainbow effect.
- \snippet particles/imageparticle/content/colortable.qml 0
+ \snippet particles/imageparticle/colortable.qml 0
Deformation spins and squishes a starfish particle.
- \snippet particles/imageparticle/content/deformation.qml spin
- \snippet particles/imageparticle/content/deformation.qml deform
+ \snippet particles/imageparticle/deformation.qml spin
+ \snippet particles/imageparticle/deformation.qml deform
Rotation demonstrates the autoRotate property, so that particles rotate in the direction that they travel.
Sharing demonstrates what happens when multiple ImageParticles try to render the same particle.
The following ImageParticle renders the particles inside the ListView:
- \snippet particles/imageparticle/content/sharing.qml 0
+ \snippet particles/imageparticle/sharing.qml 0
The following ImageParticle is placed inside the list highlight, and renders the particles above the other ImageParticle.
- \snippet particles/imageparticle/content/sharing.qml 1
+ \snippet particles/imageparticle/sharing.qml 1
Note that because it sets the color and alpha in this ImageParticle, it renders the particles in a different color.
Since it doesn't specify anything about the rotation, it shares the rotation with the other ImageParticle so that the flowers are rotated the same way in both.
Note that you can undo rotation in another ImageParticle, you just need to explicitly set rotationVariation to 0.
diff --git a/examples/quick/particles/imageparticle/imageparticle.pro b/examples/quick/particles/imageparticle/imageparticle.pro
index e639c7423a..c9c5e59eb0 100644
--- a/examples/quick/particles/imageparticle/imageparticle.pro
+++ b/examples/quick/particles/imageparticle/imageparticle.pro
@@ -4,7 +4,6 @@ QT += quick qml
SOURCES += main.cpp
RESOURCES += \
imageparticle.qrc \
- ../images.qrc \
../../shared/shared.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/imageparticle
diff --git a/examples/quick/particles/imageparticle/imageparticle.qml b/examples/quick/particles/imageparticle/imageparticle.qml
index a8dfa6a0c9..0423e72e28 100644
--- a/examples/quick/particles/imageparticle/imageparticle.qml
+++ b/examples/quick/particles/imageparticle/imageparticle.qml
@@ -48,23 +48,23 @@
**
****************************************************************************/
-import QtQuick 2.0
-import "../../shared" as Examples
+import QtQuick
+import shared
Item {
height: 480
width: 320
- Examples.LauncherList {
+ LauncherList {
id: ll
anchors.fill: parent
Component.onCompleted: {
- addExample("All at once", "Uses all ImageParticle features", Qt.resolvedUrl("content/allatonce.qml"));
- addExample("Colored", "Colorized image particles", Qt.resolvedUrl("content/colored.qml"));
- addExample("Color Table", "Color-over-life rainbow particles", Qt.resolvedUrl("content/colortable.qml"));
- addExample("Deformation", "Deformed particles", Qt.resolvedUrl("content/deformation.qml"));
- addExample("Rotation", "Rotated particles", Qt.resolvedUrl("content/rotation.qml"));
- addExample("Sharing", "Multiple ImageParticles on the same particles", Qt.resolvedUrl("content/sharing.qml"));
- addExample("Sprites", "Particles rendered with sprites", Qt.resolvedUrl("content/sprites.qml"));
+ addExample("All at once", "Uses all ImageParticle features", Qt.resolvedUrl("allatonce.qml"));
+ addExample("Colored", "Colorized image particles", Qt.resolvedUrl("colored.qml"));
+ addExample("Color Table", "Color-over-life rainbow particles", Qt.resolvedUrl("colortable.qml"));
+ addExample("Deformation", "Deformed particles", Qt.resolvedUrl("deformation.qml"));
+ addExample("Rotation", "Rotated particles", Qt.resolvedUrl("rotation.qml"));
+ addExample("Sharing", "Multiple ImageParticles on the same particles", Qt.resolvedUrl("sharing.qml"));
+ addExample("Sprites", "Particles rendered with sprites", Qt.resolvedUrl("sprites.qml"));
}
}
}
diff --git a/examples/quick/particles/imageparticle/imageparticle.qrc b/examples/quick/particles/imageparticle/imageparticle.qrc
index d9e4115e3e..ef9bddaaae 100644
--- a/examples/quick/particles/imageparticle/imageparticle.qrc
+++ b/examples/quick/particles/imageparticle/imageparticle.qrc
@@ -1,12 +1,20 @@
<RCC>
- <qresource prefix="/particles/imageparticle">
+ <qresource prefix="/imageparticle">
<file>imageparticle.qml</file>
- <file>content/allatonce.qml</file>
- <file>content/colored.qml</file>
- <file>content/colortable.qml</file>
- <file>content/deformation.qml</file>
- <file>content/rotation.qml</file>
- <file>content/sharing.qml</file>
- <file>content/sprites.qml</file>
+ <file>allatonce.qml</file>
+ <file>colored.qml</file>
+ <file>colortable.qml</file>
+ <file>deformation.qml</file>
+ <file>rotation.qml</file>
+ <file>sharing.qml</file>
+ <file>sprites.qml</file>
+ <file>images/bear_tiles.png</file>
+ <file>images/colortable.png</file>
+ <file>images/starfish_0.png</file>
+ <file>images/starfish_1.png</file>
+ <file>images/starfish_2.png</file>
+ <file>images/starfish_3.png</file>
+ <file>images/starfish_4.png</file>
+ <file>images/flower.png</file>
</qresource>
</RCC>
diff --git a/examples/quick/particles/images/bear_tiles.png b/examples/quick/particles/imageparticle/images/bear_tiles.png
index 6bbb2a9b6d..6bbb2a9b6d 100644
--- a/examples/quick/particles/images/bear_tiles.png
+++ b/examples/quick/particles/imageparticle/images/bear_tiles.png
Binary files differ
diff --git a/examples/quick/particles/images/colortable.png b/examples/quick/particles/imageparticle/images/colortable.png
index 15509ab5b7..15509ab5b7 100644
--- a/examples/quick/particles/images/colortable.png
+++ b/examples/quick/particles/imageparticle/images/colortable.png
Binary files differ
diff --git a/examples/quick/particles/images/flower.png b/examples/quick/particles/imageparticle/images/flower.png
index b5c606210e..b5c606210e 100644
--- a/examples/quick/particles/images/flower.png
+++ b/examples/quick/particles/imageparticle/images/flower.png
Binary files differ
diff --git a/examples/quick/particles/images/starfish_0.png b/examples/quick/particles/imageparticle/images/starfish_0.png
index 8747f0236e..8747f0236e 100644
--- a/examples/quick/particles/images/starfish_0.png
+++ b/examples/quick/particles/imageparticle/images/starfish_0.png
Binary files differ
diff --git a/examples/quick/particles/images/starfish_1.png b/examples/quick/particles/imageparticle/images/starfish_1.png
index 1f3f159d5e..1f3f159d5e 100644
--- a/examples/quick/particles/images/starfish_1.png
+++ b/examples/quick/particles/imageparticle/images/starfish_1.png
Binary files differ
diff --git a/examples/quick/particles/images/starfish_2.png b/examples/quick/particles/imageparticle/images/starfish_2.png
index c6c7e5a676..c6c7e5a676 100644
--- a/examples/quick/particles/images/starfish_2.png
+++ b/examples/quick/particles/imageparticle/images/starfish_2.png
Binary files differ
diff --git a/examples/quick/particles/images/starfish_3.png b/examples/quick/particles/imageparticle/images/starfish_3.png
index 307a89f815..307a89f815 100644
--- a/examples/quick/particles/images/starfish_3.png
+++ b/examples/quick/particles/imageparticle/images/starfish_3.png
Binary files differ
diff --git a/examples/quick/particles/images/starfish_4.png b/examples/quick/particles/imageparticle/images/starfish_4.png
index d61c26545a..d61c26545a 100644
--- a/examples/quick/particles/images/starfish_4.png
+++ b/examples/quick/particles/imageparticle/images/starfish_4.png
Binary files differ
diff --git a/examples/quick/particles/imageparticle/main.cpp b/examples/quick/particles/imageparticle/main.cpp
index ff0764a730..a831728d0b 100644
--- a/examples/quick/particles/imageparticle/main.cpp
+++ b/examples/quick/particles/imageparticle/main.cpp
@@ -48,4 +48,4 @@
**
****************************************************************************/
#include "../../shared/shared.h"
-DECLARATIVE_EXAMPLE_MAIN(particles/imageparticle/imageparticle)
+DECLARATIVE_EXAMPLE_MAIN(imageparticle/imageparticle)
diff --git a/examples/quick/particles/imageparticle/content/rotation.qml b/examples/quick/particles/imageparticle/rotation.qml
index d118bb1d97..f7b101d0c2 100644
--- a/examples/quick/particles/imageparticle/content/rotation.qml
+++ b/examples/quick/particles/imageparticle/rotation.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
color: "goldenrod"
@@ -59,7 +59,7 @@ Rectangle {
ImageParticle {
id: up
system: sys
- source: "../../images/starfish_2.png"
+ source: "images/starfish_2.png"
autoRotation: true //leaving these two settings at default allows you to test going up performance levels
rotation: -90
}
diff --git a/examples/quick/particles/imageparticle/content/sharing.qml b/examples/quick/particles/imageparticle/sharing.qml
index 13b0dadf85..365d2e99fd 100644
--- a/examples/quick/particles/imageparticle/content/sharing.qml
+++ b/examples/quick/particles/imageparticle/sharing.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -52,8 +52,8 @@
// that uses a SpringAnimation to provide custom movement when the
// highlight bar is moved between items.
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
@@ -108,7 +108,7 @@ Rectangle {
ImageParticle {
anchors.fill: parent
system: particles
- source: "../../images/flower.png"
+ source: "images/flower.png"
color: "red"
clip: true
alpha: 1.0
@@ -147,7 +147,7 @@ Rectangle {
ImageParticle {
anchors.fill: parent
system: particles
- source: "../../images/flower.png"
+ source: "images/flower.png"
alpha: 0.1
color: "white"
rotationVariation: 180
diff --git a/examples/quick/particles/imageparticle/content/sprites.qml b/examples/quick/particles/imageparticle/sprites.qml
index c8ffe6c0e5..3e7d09bdde 100644
--- a/examples/quick/particles/imageparticle/content/sprites.qml
+++ b/examples/quick/particles/imageparticle/sprites.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
color: "lightsteelblue"
@@ -60,7 +60,7 @@ Rectangle {
SpriteSequence {
sprites: Sprite {
name: "bear"
- source: "../../images/bear_tiles.png"
+ source: "images/bear_tiles.png"
frameCount: 13
frameDuration: 120
}
@@ -80,25 +80,25 @@ Rectangle {
system: sys
sprites: [Sprite {
name: "happy"
- source: "../../images/starfish_1.png"
+ source: "images/starfish_1.png"
frameCount: 1
frameDuration: 260
to: {"happy": 1, "silly": 1, "angry": 1}
}, Sprite {
name: "angry"
- source: "../../images/starfish_0.png"
+ source: "images/starfish_0.png"
frameCount: 1
frameDuration: 260
to: {"happy": 1, "silly": 1, "angry": 1}
}, Sprite {
name: "silly"
- source: "../../images/starfish_2.png"
+ source: "images/starfish_2.png"
frameCount: 1
frameDuration: 260
to: {"happy": 1, "silly": 1, "noticedbear": 0}
}, Sprite {
name: "noticedbear"
- source: "../../images/starfish_3.png"
+ source: "images/starfish_3.png"
frameCount: 1
frameDuration: 2600
}]
diff --git a/examples/quick/particles/images.qrc b/examples/quick/particles/images.qrc
deleted file mode 100644
index 1f754838a8..0000000000
--- a/examples/quick/particles/images.qrc
+++ /dev/null
@@ -1,35 +0,0 @@
-<RCC>
- <qresource prefix="/particles">
- <file>images/_explo.png</file>
- <file>images/backgroundLeaves.jpg</file>
- <file>images/bear_tiles.png</file>
- <file>images/candle.png</file>
- <file>images/colortable.png</file>
- <file>images/finalfrontier.png</file>
- <file>images/flower.png</file>
- <file>images/matchmask.png</file>
- <file>images/meteor_explo.png</file>
- <file>images/meteor.png</file>
- <file>images/meteors.png</file>
- <file>images/nullRock.png</file>
- <file>images/particle2.png</file>
- <file>images/particle3.png</file>
- <file>images/particleA.png</file>
- <file>images/portal_bg.png</file>
- <file>images/realLeaf1.png</file>
- <file>images/realLeaf2.png</file>
- <file>images/realLeaf3.png</file>
- <file>images/realLeaf4.png</file>
- <file>images/rocket.png</file>
- <file>images/rocket2.png</file>
- <file>images/sizeInOut.png</file>
- <file>images/snowflake.png</file>
- <file>images/sparkleSize.png</file>
- <file>images/starfish_0.png</file>
- <file>images/starfish_1.png</file>
- <file>images/starfish_2.png</file>
- <file>images/starfish_3.png</file>
- <file>images/starfish_4.png</file>
- <file>images/starfish_mask.png</file>
- </qresource>
-</RCC>
diff --git a/examples/quick/particles/images/meteor_explo.png b/examples/quick/particles/images/meteor_explo.png
deleted file mode 100644
index e659bfe2cf..0000000000
--- a/examples/quick/particles/images/meteor_explo.png
+++ /dev/null
Binary files differ
diff --git a/examples/quick/particles/images/meteors.png b/examples/quick/particles/images/meteors.png
deleted file mode 100644
index bada8a1407..0000000000
--- a/examples/quick/particles/images/meteors.png
+++ /dev/null
Binary files differ
diff --git a/examples/quick/particles/images/sizeInOut.png b/examples/quick/particles/images/sizeInOut.png
deleted file mode 100644
index 43d8862dbe..0000000000
--- a/examples/quick/particles/images/sizeInOut.png
+++ /dev/null
Binary files differ
diff --git a/examples/quick/particles/itemparticle/CMakeLists.txt b/examples/quick/particles/itemparticle/CMakeLists.txt
index 1c435c3c1b..6df338e00e 100644
--- a/examples/quick/particles/itemparticle/CMakeLists.txt
+++ b/examples/quick/particles/itemparticle/CMakeLists.txt
@@ -1,13 +1,9 @@
-# Generated from itemparticle.pro.
-
cmake_minimum_required(VERSION 3.16)
project(itemparticle 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")
@@ -15,119 +11,38 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/itemparticle")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
+find_package(Qt6 COMPONENTS Core Gui Quick Qml)
+
+add_subdirectory("../../shared" "shared")
-qt_add_executable(itemparticle
+qt_add_executable(itemparticleexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(itemparticle PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(itemparticle PUBLIC
+target_link_libraries(itemparticleexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
)
-
-file(GLOB resource_glob_0 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "content/*")
-foreach(file IN LISTS resource_glob_0)
- set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
-endforeach()
-
-file(GLOB resource_glob_1 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "*qml")
-foreach(file IN LISTS resource_glob_1)
- set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}")
-endforeach()
+add_dependencies(itemparticleexample itemparticle_shared)
# Resources:
-set(images_resource_files
- "../images/_explo.png"
- "../images/backgroundLeaves.jpg"
- "../images/bear_tiles.png"
- "../images/candle.png"
- "../images/colortable.png"
- "../images/finalfrontier.png"
- "../images/flower.png"
- "../images/matchmask.png"
- "../images/meteor.png"
- "../images/meteor_explo.png"
- "../images/meteors.png"
- "../images/nullRock.png"
- "../images/particle2.png"
- "../images/particle3.png"
- "../images/particleA.png"
- "../images/portal_bg.png"
- "../images/realLeaf1.png"
- "../images/realLeaf2.png"
- "../images/realLeaf3.png"
- "../images/realLeaf4.png"
- "../images/rocket.png"
- "../images/rocket2.png"
- "../images/sizeInOut.png"
- "../images/snowflake.png"
- "../images/sparkleSize.png"
- "../images/starfish_0.png"
- "../images/starfish_1.png"
- "../images/starfish_2.png"
- "../images/starfish_3.png"
- "../images/starfish_4.png"
- "../images/starfish_mask.png"
-)
-
-qt6_add_resources(itemparticle "images"
- PREFIX
- "/particles"
- BASE
- ".."
- FILES
- ${images_resource_files}
-)
-set(shared_resource_files
- "../../shared/Button.qml"
- "../../shared/CheckBox.qml"
- "../../shared/FlickrRssModel.qml"
- "../../shared/Label.qml"
- "../../shared/LauncherList.qml"
- "../../shared/SimpleLauncherDelegate.qml"
- "../../shared/Slider.qml"
- "../../shared/TabSet.qml"
- "../../shared/TextField.qml"
- "../../shared/images/back.png"
- "../../shared/images/checkmark.png"
- "../../shared/images/next.png"
- "../../shared/images/qt-logo.png"
- "../../shared/images/slider_handle.png"
- "../../shared/images/tab.png"
-)
-
-qt6_add_resources(itemparticle "shared"
- PREFIX
- "/shared"
- BASE
- "../../shared"
- FILES
- ${shared_resource_files}
-)
-set(qmake_immediate_resource_files
- ${resource_glob_0}
- ${resource_glob_1}
-)
-
-qt6_add_resources(itemparticle "qmake_immediate"
- PREFIX
- "/"
- FILES
- ${qmake_immediate_resource_files}
-)
-
-install(TARGETS itemparticle
+qt_add_qml_module(itemparticleexample
+ URI itemparticle
+ VERSION 1.0
+ QML_FILES
+ "itemparticle.qml"
+ "delegates.qml"
+ "script.js"
+ RESOURCES
+ "images/rocket.png"
+)
+
+install(TARGETS itemparticleexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
+
+bundle_shared(itemparticleexample)
diff --git a/examples/quick/particles/itemparticle/content/Delegate.qml b/examples/quick/particles/itemparticle/content/Delegate.qml
deleted file mode 100644
index 946b7b8748..0000000000
--- a/examples/quick/particles/itemparticle/content/Delegate.qml
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//![0]
-Package {
- Text { id: listDelegate; width: 200; height: 25; text: 'Empty'; Package.name: 'list' }
- Text { id: gridDelegate; width: 100; height: 50; text: 'Empty'; Package.name: 'grid' }
-
- Rectangle {
- id: wrapper
- width: 200; height: 25
- color: 'lightsteelblue'
-
- Text { text: display; anchors.centerIn: parent }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- if (wrapper.state == 'inList')
- wrapper.state = 'inGrid';
- else
- wrapper.state = 'inList';
- }
- }
-
- state: 'inList'
- states: [
- State {
- name: 'inList'
- ParentChange { target: wrapper; parent: listDelegate }
- },
- State {
- name: 'inGrid'
- ParentChange {
- target: wrapper; parent: gridDelegate
- x: 0; y: 0; width: gridDelegate.width; height: gridDelegate.height
- }
- }
- ]
-
- transitions: [
- Transition {
- ParentAnimation {
- NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
- }
- }
- ]
- }
-}
-//![0]
diff --git a/examples/quick/particles/itemparticle/content/Delegate2.qml b/examples/quick/particles/itemparticle/content/Delegate2.qml
deleted file mode 100644
index 03465609d9..0000000000
--- a/examples/quick/particles/itemparticle/content/Delegate2.qml
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-//![0]
-Package {
- Item { id: gridDelegate; width: w; height: h; Package.name: 'grid' }
- Item { id: particleDelegate; width: w; height: h; Package.name: 'particles'
-
- Rectangle {
- id: wrapper
- width: w; height: h;
- color: col
- rotation: Math.random()*360
- Behavior on rotation {RotationAnimation {}}
-
- states: State {
- name: "gridded"
- when: root.inGrid
- PropertyChanges {
- target: wrapper
- rotation: 0
- }
- ParentChange {
- target: wrapper
- parent: gridDelegate
- x:0
- y:0
- }
- }
- transitions: [
- Transition {
- ParentAnimation {
- NumberAnimation { properties: 'x,y,width,height'; duration: 300 }
- }
- }
- ]
- }
- }
-}
-//![0]
diff --git a/examples/quick/particles/itemparticle/content/ExpandingDelegate.qml b/examples/quick/particles/itemparticle/content/ExpandingDelegate.qml
deleted file mode 100644
index 9ffbc7f350..0000000000
--- a/examples/quick/particles/itemparticle/content/ExpandingDelegate.qml
+++ /dev/null
@@ -1,215 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 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$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import "../../../modelviews/listview/content"
-
-// This example illustrates expanding a list item to show a more detailed view.
-
- // Delegate for the recipes. This delegate has two modes:
- // 1. List mode (default), which just shows the picture and title of the recipe.
- // 2. Details mode, which also shows the ingredients and method.
- Component {
- id: recipeDelegate
-
- Item {
- id: recipe
-
- // Create a property to contain the visibility of the details.
- // We can bind multiple element's opacity to this one property,
- // rather than having a "PropertyChanges" line for each element we
- // want to fade.
- property real detailsOpacity : 0
-
- //this bit changed for aesthetics
- width: 70
- height: 70
- // A simple rounded rectangle for the background
- Rectangle {
- id: background
- x: 2; y: 2; width: parent.width - x*2; height: parent.height - y*2
- color: "ivory"
- border.color: "orange"
- radius: 5
- antialiasing: true
- }
- Image {
- anchors.fill:parent
- anchors.margins: -32
- source: "bubble.png"
- }
-
-
- // This mouse region covers the entire delegate.
- // When clicked it changes mode to 'Details'. If we are already
- // in Details mode, then no change will happen.
- MouseArea {
- anchors.fill: parent
- onClicked: recipe.state = 'Details';
- }
-
- // Lay out the page: picture, title and ingredients at the top, and method at the
- // bottom. Note that elements that should not be visible in the list
- // mode have their opacity set to recipe.detailsOpacity.
- Row {
- id: topLayout
- x: 10; y: 10; height: recipeImage.height; width: parent.width
- spacing: 10
-
- Image {
- id: recipeImage
- width: 50; height: 50
- source: "../../modelviews/listview/" + picture
- }
-
- Column {
- width: background.width - recipeImage.width - 20; height: recipeImage.height
- spacing: 5
-
- Text {
- text: title
- font.bold: true; font.pointSize: 16
- }
-
- Text {
- text: "Ingredients"
- font.pointSize: 12; font.bold: true
- opacity: recipe.detailsOpacity
- }
-
- Text {
- text: ingredients
- wrapMode: Text.WordWrap
- width: parent.width
- opacity: recipe.detailsOpacity
- }
- }
- }
-
- Item {
- id: details
- x: 10; width: parent.width - 20
- anchors { top: topLayout.bottom; topMargin: 10; bottom: parent.bottom; bottomMargin: 10 }
- opacity: recipe.detailsOpacity
-
- Text {
- id: methodTitle
- anchors.top: parent.top
- text: "Method"
- font.pointSize: 12; font.bold: true
- }
-
- Flickable {
- id: flick
- width: parent.width
- anchors { top: methodTitle.bottom; bottom: parent.bottom }
- contentHeight: methodText.height
- clip: true
-
- Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width }
- }
-
- Image {
- anchors { right: flick.right; top: flick.top }
- source: "../../modelviews/listview/" + "content/pics/moreUp.png"
- opacity: flick.atYBeginning ? 0 : 1
- }
-
- Image {
- anchors { right: flick.right; bottom: flick.bottom }
- source: "../../modelviews/listview/" + "content/pics/moreDown.png"
- opacity: flick.atYEnd ? 0 : 1
- }
- }
-
- // A button to close the detailed view, i.e. set the state back to default ('').
- TextButton {
- y: 10
- anchors { right: background.right; rightMargin: 10 }
- opacity: recipe.detailsOpacity
- text: "Close"
-
- onClicked: recipe.state = '';
- }
-
- states: State {
- name: "Details"
-
- PropertyChanges { target: background; color: "white" }
- PropertyChanges { target: recipeImage; width: 130; height: 130 } // Make picture bigger
- PropertyChanges { target: recipe; detailsOpacity: 1; x: 0; opacity: 1 } // Make details visible
- PropertyChanges { target: recipe; height: root.height; width: root.height; x:0; y:0; z:100} // Fill the entire list area with the detailed view
-
- // Move the list so that this item is at the top.
- //PropertyChanges { target: recipe.ListView.view; explicit: true; contentY: recipe.y }
-
- // Disallow flicking while we're in detailed view
- //PropertyChanges { target: recipe.ListView.view; interactive: false }
- }
-
- transitions: Transition {
- //The only strictly necessary particle specific lines
- to: "Details"
- reversible: true
- ScriptAction {script: {
- if(state == "Details")
- mp.freeze(index);
- else
- mp.unfreeze(index);
- }
- }
- // Make the state changes smooth
- ParallelAnimation {
- ColorAnimation { property: "color"; duration: 500 }
- NumberAnimation { duration: 300; properties: "detailsOpacity,opacity,x,y,height,width" }
- }
- }
- }
- }
diff --git a/examples/quick/particles/itemparticle/content/bubble.png b/examples/quick/particles/itemparticle/content/bubble.png
deleted file mode 100644
index f26ed1d3f2..0000000000
--- a/examples/quick/particles/itemparticle/content/bubble.png
+++ /dev/null
Binary files differ
diff --git a/examples/quick/particles/itemparticle/delegates.qml b/examples/quick/particles/itemparticle/delegates.qml
index 0e9267214f..a53c719828 100644
--- a/examples/quick/particles/itemparticle/delegates.qml
+++ b/examples/quick/particles/itemparticle/delegates.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root;
diff --git a/examples/quick/particles/itemparticle/images/rocket.png b/examples/quick/particles/itemparticle/images/rocket.png
new file mode 100644
index 0000000000..a171610b03
--- /dev/null
+++ b/examples/quick/particles/itemparticle/images/rocket.png
Binary files differ
diff --git a/examples/quick/particles/itemparticle/itemparticle.pro b/examples/quick/particles/itemparticle/itemparticle.pro
index f5c0576b4a..c0426cd032 100644
--- a/examples/quick/particles/itemparticle/itemparticle.pro
+++ b/examples/quick/particles/itemparticle/itemparticle.pro
@@ -3,10 +3,8 @@ TEMPLATE = app
QT += quick qml
SOURCES += main.cpp
RESOURCES += \
- ../images.qrc \
- ../../shared/shared.qrc \
- $$files("content/*") \
- $$files("*qml")
+ itemparticle.qrc \
+ ../../shared/shared.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/itemparticle
INSTALLS += target
diff --git a/examples/quick/particles/itemparticle/particleview.qml b/examples/quick/particles/itemparticle/itemparticle.qml
index 8eb18dc283..ad2038fdbf 100644
--- a/examples/quick/particles/itemparticle/particleview.qml
+++ b/examples/quick/particles/itemparticle/itemparticle.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,11 +48,10 @@
**
****************************************************************************/
-import QtQuick 2.12
-import QtQuick.Particles 2.12
-import "shared" as Shared
-import "content/script.js" as Script
-import "content"
+import QtQuick
+import QtQuick.Particles
+import shared
+import "script.js" as Script
Item {
id: root
@@ -127,7 +126,7 @@ Item {
to: 1
}
Image {
- source: "qrc:///particles/images/rocket.png"
+ source: "images/rocket.png"
anchors.centerIn: parent
}
Text {
@@ -209,7 +208,7 @@ Item {
delegate: theDelegate
}
}
- Shared.FlickrRssModel {
+ FlickrRssModel {
id: flickrModel
tags: "particle,particles"
}
@@ -281,16 +280,17 @@ Item {
parent: root
}
PropertyChanges {
- target: image
- source: image.media
- x: 0
- y: 0
- width: root.width
- height: root.height
- z: 101
- opacity: 1
- rotation: 0
- darken: 0
+ image {
+ source: image.media
+ x: 0
+ y: 0
+ width: root.width
+ height: root.height
+ z: 101
+ opacity: 1
+ rotation: 0
+ darken: 0
+ }
}
}
transitions: Transition {
diff --git a/examples/quick/particles/itemparticle/itemparticle.qrc b/examples/quick/particles/itemparticle/itemparticle.qrc
new file mode 100644
index 0000000000..f951ba6366
--- /dev/null
+++ b/examples/quick/particles/itemparticle/itemparticle.qrc
@@ -0,0 +1,8 @@
+<RCC>
+ <qresource prefix="/itemparticle">
+ <file>itemparticle.qml</file>
+ <file>delegates.qml</file>
+ <file>script.js</file>
+ <file>images/rocket.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/quick/particles/itemparticle/main.cpp b/examples/quick/particles/itemparticle/main.cpp
index da21f15be3..5c7f7d5f3c 100644
--- a/examples/quick/particles/itemparticle/main.cpp
+++ b/examples/quick/particles/itemparticle/main.cpp
@@ -48,4 +48,4 @@
**
****************************************************************************/
#include "../../shared/shared.h"
-DECLARATIVE_EXAMPLE_MAIN(particleview)
+DECLARATIVE_EXAMPLE_MAIN(itemparticle/itemparticle)
diff --git a/examples/quick/particles/itemparticle/content/script.js b/examples/quick/particles/itemparticle/script.js
index e8ef93a847..e8ef93a847 100644
--- a/examples/quick/particles/itemparticle/content/script.js
+++ b/examples/quick/particles/itemparticle/script.js
diff --git a/examples/quick/particles/particles.pro b/examples/quick/particles/particles.pro
index 5343fa00f1..7ef86618d5 100644
--- a/examples/quick/particles/particles.pro
+++ b/examples/quick/particles/particles.pro
@@ -5,9 +5,6 @@ SUBDIRS += affectors \
itemparticle \
system
-EXAMPLE_FILES = \
- images.qrc
-
#Install shared images too
qml.files = images
qml.path = $$[QT_INSTALL_EXAMPLES]/quick/particles
diff --git a/examples/quick/particles/system/CMakeLists.txt b/examples/quick/particles/system/CMakeLists.txt
index 6570678a2b..c8ab118550 100644
--- a/examples/quick/particles/system/CMakeLists.txt
+++ b/examples/quick/particles/system/CMakeLists.txt
@@ -7,7 +7,6 @@ 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")
@@ -15,113 +14,43 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/particles/system")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
+find_package(Qt6 COMPONENTS Core Gui Quick Qml)
-qt_add_executable(system
+add_subdirectory("../../shared" "shared")
+
+qt_add_executable(systemexample WIN32 MACOSX_BUNDLE
main.cpp
)
-set_target_properties(system PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(system PUBLIC
+target_link_libraries(systemexample PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
Qt::Quick
)
+add_dependencies(systemexample system_shared)
# Resources:
-set(system_resource_files
- "content/dynamiccomparison.qml"
- "content/dynamicemitters.qml"
- "content/multiplepainters.qml"
- "content/startstop.qml"
- "content/timedgroupchanges.qml"
- "system.qml"
-)
-
-qt6_add_resources(system "system"
- PREFIX
- "/particles/system"
- FILES
- ${system_resource_files}
-)
-set(images_resource_files
- "../images/_explo.png"
- "../images/backgroundLeaves.jpg"
- "../images/bear_tiles.png"
- "../images/candle.png"
- "../images/colortable.png"
- "../images/finalfrontier.png"
- "../images/flower.png"
- "../images/matchmask.png"
- "../images/meteor.png"
- "../images/meteor_explo.png"
- "../images/meteors.png"
- "../images/nullRock.png"
- "../images/particle2.png"
- "../images/particle3.png"
- "../images/particleA.png"
- "../images/portal_bg.png"
- "../images/realLeaf1.png"
- "../images/realLeaf2.png"
- "../images/realLeaf3.png"
- "../images/realLeaf4.png"
- "../images/rocket.png"
- "../images/rocket2.png"
- "../images/sizeInOut.png"
- "../images/snowflake.png"
- "../images/sparkleSize.png"
- "../images/starfish_0.png"
- "../images/starfish_1.png"
- "../images/starfish_2.png"
- "../images/starfish_3.png"
- "../images/starfish_4.png"
- "../images/starfish_mask.png"
-)
-
-qt6_add_resources(system "images"
- PREFIX
- "/particles"
- BASE
- ".."
- FILES
- ${images_resource_files}
-)
-set(shared_resource_files
- "../../shared/Button.qml"
- "../../shared/CheckBox.qml"
- "../../shared/FlickrRssModel.qml"
- "../../shared/Label.qml"
- "../../shared/LauncherList.qml"
- "../../shared/SimpleLauncherDelegate.qml"
- "../../shared/Slider.qml"
- "../../shared/TabSet.qml"
- "../../shared/TextField.qml"
- "../../shared/images/back.png"
- "../../shared/images/checkmark.png"
- "../../shared/images/next.png"
- "../../shared/images/qt-logo.png"
- "../../shared/images/slider_handle.png"
- "../../shared/images/tab.png"
-)
-
-qt6_add_resources(system "shared"
- PREFIX
- "/shared"
- BASE
- "../../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS system
+qt_add_qml_module(systemexample
+ URI system
+ VERSION 1.0
+ QML_FILES
+ "dynamiccomparison.qml"
+ "dynamicemitters.qml"
+ "multiplepainters.qml"
+ "timedgroupchanges.qml"
+ "startstop.qml"
+ "system.qml"
+ RESOURCES
+ "images/sparkleSize.png"
+ "images/particle2.png"
+ "images/particle3.png"
+)
+
+install(TARGETS systemexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
)
+
+bundle_shared(systemexample)
diff --git a/examples/quick/particles/system/doc/src/system.qdoc b/examples/quick/particles/system/doc/src/system.qdoc
index 22382190d3..6b795070fd 100644
--- a/examples/quick/particles/system/doc/src/system.qdoc
+++ b/examples/quick/particles/system/doc/src/system.qdoc
@@ -35,7 +35,7 @@
Each example is a small QML file emphasizing a particular type or feature.
Dynamic comparison compares using the particle system to getting a similar effect with the following code that dynamically instantiates Image types.
- \snippet particles/system/content/dynamiccomparison.qml fake
+ \snippet particles/system/dynamiccomparison.qml fake
Note how the Image objects are not able to be randomly colorized.
Start and Stop simply sets the running and paused states of a ParticleSystem. While the system does not perform any simulation when stopped or paused, a restart restarts the simulation from the beginning, while unpausing resumes the simulation from where it was.
@@ -43,14 +43,14 @@
Timed group changes is an example that highlights the ParticleGroup type. While normally referring to groups with a string name is sufficient, additional effects can be
done by setting properties on groups.
The first group has a variable duration on it, but always transitions to the second group.
- \snippet particles/system/content/timedgroupchanges.qml 0
+ \snippet particles/system/timedgroupchanges.qml 0
The second group has a TrailEmitter on it, and a fixed duration for emitting into the third group. By placing the TrailEmitter as a direct child of the ParticleGroup, it automatically selects that group to follow.
- \snippet particles/system/content/timedgroupchanges.qml 1
+ \snippet particles/system/timedgroupchanges.qml 1
The third group has an Affector as a direct child, which makes the affector automatically target this group. The affector means that as soon as particles enter this group, a burst function can be called on another emitter, using the x,y positions of this particle.
- \snippet particles/system/content/timedgroupchanges.qml 2
+ \snippet particles/system/timedgroupchanges.qml 2
If TrailEmitter does not suit your needs for multiple emitters, you can also dynamically create Emitters while still using the same ParticleSystem and image particle
- \snippet particles/system/content/dynamicemitters.qml 0
+ \snippet particles/system/dynamicemitters.qml 0
Note that this effect, a flurry of flying rainbow spears, would be better served with TrailEmitter. It is only done with dynamic emitters in this example to show the concept more simply.
Multiple Painters shows how to control paint ordering of individual particles. While the paint ordering of particles within one ImagePainter is not strictly defined, ImageParticle objects follow the normal Z-ordering rules for \l {Qt Quick} items. This example allow you to paint the inside of the particles above the black borders using a pair of ImageParticles each painting different parts of the same logical particle.
diff --git a/examples/quick/particles/system/content/dynamiccomparison.qml b/examples/quick/particles/system/dynamiccomparison.qml
index c1d42863ee..ad529a2041 100644
--- a/examples/quick/particles/system/content/dynamiccomparison.qml
+++ b/examples/quick/particles/system/dynamiccomparison.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
diff --git a/examples/quick/particles/system/content/dynamicemitters.qml b/examples/quick/particles/system/dynamicemitters.qml
index 8eb87d2baa..2b1ca0885e 100644
--- a/examples/quick/particles/system/content/dynamicemitters.qml
+++ b/examples/quick/particles/system/dynamicemitters.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
diff --git a/examples/quick/particles/images/particle2.png b/examples/quick/particles/system/images/particle2.png
index 4f3372cd07..4f3372cd07 100644
--- a/examples/quick/particles/images/particle2.png
+++ b/examples/quick/particles/system/images/particle2.png
Binary files differ
diff --git a/examples/quick/particles/images/particle3.png b/examples/quick/particles/system/images/particle3.png
index 2b04601403..2b04601403 100644
--- a/examples/quick/particles/images/particle3.png
+++ b/examples/quick/particles/system/images/particle3.png
Binary files differ
diff --git a/examples/quick/particles/images/sparkleSize.png b/examples/quick/particles/system/images/sparkleSize.png
index 752056541b..752056541b 100644
--- a/examples/quick/particles/images/sparkleSize.png
+++ b/examples/quick/particles/system/images/sparkleSize.png
Binary files differ
diff --git a/examples/quick/particles/system/main.cpp b/examples/quick/particles/system/main.cpp
index 63a88412f5..cc77f3a62d 100644
--- a/examples/quick/particles/system/main.cpp
+++ b/examples/quick/particles/system/main.cpp
@@ -48,4 +48,4 @@
**
****************************************************************************/
#include "../../shared/shared.h"
-DECLARATIVE_EXAMPLE_MAIN(particles/system/system)
+DECLARATIVE_EXAMPLE_MAIN(system/system)
diff --git a/examples/quick/particles/system/content/multiplepainters.qml b/examples/quick/particles/system/multiplepainters.qml
index 1f2dcb6214..62ca583e2e 100644
--- a/examples/quick/particles/system/content/multiplepainters.qml
+++ b/examples/quick/particles/system/multiplepainters.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
@@ -83,14 +83,14 @@ Rectangle {
ImageParticle {
system: sys
visible: !cloneMode
- source: "../../images/particle2.png"
+ source: "images/particle2.png"
}
ImageParticle {
system: sys
visible: cloneMode
z: 0
- source: "../../images/particle3.png"
+ source: "images/particle3.png"
}
ImageParticle {
diff --git a/examples/quick/particles/system/content/startstop.qml b/examples/quick/particles/system/startstop.qml
index a9ef7285aa..1eff8e962e 100644
--- a/examples/quick/particles/system/content/startstop.qml
+++ b/examples/quick/particles/system/startstop.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
width: 360
@@ -80,7 +80,7 @@ Rectangle {
anchors.fill: parent
system: particles
source: "qrc:///particleresources/star.png"
- sizeTable: "../../images/sparkleSize.png"
+ sizeTable: "images/sparkleSize.png"
alpha: 0
colorVariation: 0.6
}
diff --git a/examples/quick/particles/system/system.pro b/examples/quick/particles/system/system.pro
index df143f10a3..ea620f687a 100644
--- a/examples/quick/particles/system/system.pro
+++ b/examples/quick/particles/system/system.pro
@@ -4,7 +4,6 @@ QT += quick qml
SOURCES += main.cpp
RESOURCES += \
system.qrc \
- ../images.qrc \
../../shared/shared.qrc
target.path = $$[QT_INSTALL_EXAMPLES]/quick/particles/system
diff --git a/examples/quick/particles/system/system.qml b/examples/quick/particles/system/system.qml
index 569676d424..9f3af98744 100644
--- a/examples/quick/particles/system/system.qml
+++ b/examples/quick/particles/system/system.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,21 +48,21 @@
**
****************************************************************************/
-import QtQuick 2.0
-import "../../shared" as Examples
+import QtQuick
+import shared
Item {
height: 480
width: 320
- Examples.LauncherList {
+ LauncherList {
id: ll
anchors.fill: parent
Component.onCompleted: {
- addExample("Dynamic Comparison", "Compares with dynamically created elements", Qt.resolvedUrl("content/dynamiccomparison.qml"));
- addExample("StartStop", "Start and stop the simulation", Qt.resolvedUrl("content/startstop.qml"));
- addExample("Timed group changes", "Emit into managed groups", Qt.resolvedUrl("content/timedgroupchanges.qml"));
- addExample("Dynamic Emitters", "Dynamically instantiated emitters with a single system", Qt.resolvedUrl("content/dynamicemitters.qml"));
- addExample("Multiple Painters", "Several ParticlePainters on the same logical particles", Qt.resolvedUrl("content/multiplepainters.qml"));
+ addExample("Dynamic Comparison", "Compares with dynamically created elements", Qt.resolvedUrl("dynamiccomparison.qml"));
+ addExample("StartStop", "Start and stop the simulation", Qt.resolvedUrl("startstop.qml"));
+ addExample("Timed group changes", "Emit into managed groups", Qt.resolvedUrl("timedgroupchanges.qml"));
+ addExample("Dynamic Emitters", "Dynamically instantiated emitters with a single system", Qt.resolvedUrl("dynamicemitters.qml"));
+ addExample("Multiple Painters", "Several ParticlePainters on the same logical particles", Qt.resolvedUrl("multiplepainters.qml"));
}
}
}
diff --git a/examples/quick/particles/system/system.qrc b/examples/quick/particles/system/system.qrc
index 3fb8221fb1..e86bc19e68 100644
--- a/examples/quick/particles/system/system.qrc
+++ b/examples/quick/particles/system/system.qrc
@@ -1,10 +1,13 @@
<RCC>
- <qresource prefix="/particles/system">
+ <qresource prefix="/system">
<file>system.qml</file>
- <file>content/dynamiccomparison.qml</file>
- <file>content/dynamicemitters.qml</file>
- <file>content/multiplepainters.qml</file>
- <file>content/startstop.qml</file>
- <file>content/timedgroupchanges.qml</file>
+ <file>dynamiccomparison.qml</file>
+ <file>dynamicemitters.qml</file>
+ <file>multiplepainters.qml</file>
+ <file>startstop.qml</file>
+ <file>timedgroupchanges.qml</file>
+ <file>images/sparkleSize.png</file>
+ <file>images/particle2.png</file>
+ <file>images/particle3.png</file>
</qresource>
</RCC>
diff --git a/examples/quick/particles/system/content/timedgroupchanges.qml b/examples/quick/particles/system/timedgroupchanges.qml
index cab992f898..e3eb0c3d08 100644
--- a/examples/quick/particles/system/content/timedgroupchanges.qml
+++ b/examples/quick/particles/system/timedgroupchanges.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
width: 360
diff --git a/examples/quick/pointerhandlers/CMakeLists.txt b/examples/quick/pointerhandlers/CMakeLists.txt
index ca378d49e1..1447bbe16d 100644
--- a/examples/quick/pointerhandlers/CMakeLists.txt
+++ b/examples/quick/pointerhandlers/CMakeLists.txt
@@ -21,13 +21,14 @@ qt_add_executable(pointerhandlersexample WIN32 MACOSX_BUNDLE main.cpp)
target_link_libraries(pointerhandlersexample PUBLIC
Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
- Qt::Svg
- pointerhandlers_shared
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+ Qt::Svg
)
+add_dependencies(pointerhandlersexample pointerhandlers_shared)
+
qt_add_qml_module(pointerhandlersexample
URI pointerhandlers
VERSION 1.0
diff --git a/examples/quick/pointerhandlers/components/FakeFlickable.qml b/examples/quick/pointerhandlers/components/FakeFlickable.qml
index 2857d066aa..5e652e4e68 100644
--- a/examples/quick/pointerhandlers/components/FakeFlickable.qml
+++ b/examples/quick/pointerhandlers/components/FakeFlickable.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.14
-import Qt.labs.animation 1.0
+import QtQuick
+import Qt.labs.animation
Item {
id: root
diff --git a/examples/quick/pointerhandlers/components/FlashAnimation.qml b/examples/quick/pointerhandlers/components/FlashAnimation.qml
index 047112d22c..ac41b2c1d6 100644
--- a/examples/quick/pointerhandlers/components/FlashAnimation.qml
+++ b/examples/quick/pointerhandlers/components/FlashAnimation.qml
@@ -48,20 +48,14 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick
SequentialAnimation {
id: tapFlash
running: false
+ loops: 3
PropertyAction { value: false }
PauseAnimation { duration: 100 }
PropertyAction { value: true }
PauseAnimation { duration: 100 }
- PropertyAction { value: false }
- PauseAnimation { duration: 100 }
- PropertyAction { value: true }
- PauseAnimation { duration: 100 }
- PropertyAction { value: false }
- PauseAnimation { duration: 100 }
- PropertyAction { value: true }
}
diff --git a/examples/quick/pointerhandlers/components/MomentumAnimation.qml b/examples/quick/pointerhandlers/components/MomentumAnimation.qml
index 03e1689317..a19d41c83f 100644
--- a/examples/quick/pointerhandlers/components/MomentumAnimation.qml
+++ b/examples/quick/pointerhandlers/components/MomentumAnimation.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick
ParallelAnimation {
id: root
diff --git a/examples/quick/pointerhandlers/components/MouseFeedbackSprite.qml b/examples/quick/pointerhandlers/components/MouseFeedbackSprite.qml
index 4d6f1843c8..0fa2db3aa7 100644
--- a/examples/quick/pointerhandlers/components/MouseFeedbackSprite.qml
+++ b/examples/quick/pointerhandlers/components/MouseFeedbackSprite.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick
PointHandler {
id: handler
diff --git a/examples/quick/pointerhandlers/components/ScrollBar.qml b/examples/quick/pointerhandlers/components/ScrollBar.qml
index f5cf27a0c5..0ed720eca0 100644
--- a/examples/quick/pointerhandlers/components/ScrollBar.qml
+++ b/examples/quick/pointerhandlers/components/ScrollBar.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick
Rectangle {
id: root
diff --git a/examples/quick/pointerhandlers/components/TouchpointFeedbackSprite.qml b/examples/quick/pointerhandlers/components/TouchpointFeedbackSprite.qml
index 5a4f258b8c..d8e76c1046 100644
--- a/examples/quick/pointerhandlers/components/TouchpointFeedbackSprite.qml
+++ b/examples/quick/pointerhandlers/components/TouchpointFeedbackSprite.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick
PointHandler {
id: handler
diff --git a/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-fakeflickable.jpg b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-fakeflickable.jpg
new file mode 100644
index 0000000000..5149665a07
--- /dev/null
+++ b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-fakeflickable.jpg
Binary files differ
diff --git a/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-fling.webp b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-fling.webp
new file mode 100644
index 0000000000..4b8794971e
--- /dev/null
+++ b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-fling.webp
Binary files differ
diff --git a/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-joystick.jpg b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-joystick.jpg
new file mode 100644
index 0000000000..c9d167b1e7
--- /dev/null
+++ b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-joystick.jpg
Binary files differ
diff --git a/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-map.webp b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-map.webp
new file mode 100644
index 0000000000..b96b0cf90a
--- /dev/null
+++ b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-map.webp
Binary files differ
diff --git a/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-mixer.webp b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-mixer.webp
new file mode 100644
index 0000000000..f263458d12
--- /dev/null
+++ b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-mixer.webp
Binary files differ
diff --git a/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-multibutton.webp b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-multibutton.webp
new file mode 100644
index 0000000000..1d13805c64
--- /dev/null
+++ b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-multibutton.webp
Binary files differ
diff --git a/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-pinchhandler.webp b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-pinchhandler.webp
new file mode 100644
index 0000000000..89f61251ab
--- /dev/null
+++ b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-pinchhandler.webp
Binary files differ
diff --git a/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-pointhandler.webp b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-pointhandler.webp
new file mode 100644
index 0000000000..1a0ac33d0c
--- /dev/null
+++ b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-pointhandler.webp
Binary files differ
diff --git a/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-taphandler.webp b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-taphandler.webp
new file mode 100644
index 0000000000..162e97ea15
--- /dev/null
+++ b/examples/quick/pointerhandlers/doc/images/pointerhandlers-example-taphandler.webp
Binary files differ
diff --git a/examples/quick/pointerhandlers/doc/src/pointerhandlers.qdoc b/examples/quick/pointerhandlers/doc/src/pointerhandlers.qdoc
new file mode 100644
index 0000000000..7d19d47219
--- /dev/null
+++ b/examples/quick/pointerhandlers/doc/src/pointerhandlers.qdoc
@@ -0,0 +1,184 @@
+/****************************************************************************
+**
+** Copyright (C) 2023 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 pointerhandlers
+ \title Pointer Handlers Example
+ \ingroup qtquickexamples
+ \meta tags {quick, input handlers}
+ \brief Shows how to use \l {Qt Quick Input Handlers} in interactive components.
+
+ \l {Qt Quick Controls} contains pre-built components that are sufficient
+ for many kinds of user interfaces; but you may sometimes find a need to
+ write such components "from scratch". In that case, you will need to make
+ substantial use of Pointer Handlers. This is a collection of small examples
+ that show how to implement some common and less-common interaction patterns.
+
+ If you build the example as an executable, you can choose pages from a
+ top-level ListView. The \c TouchpointFeedbackSprite and \c MouseFeedbackSprite
+ components show how to use PointHandler to provide feedback about what the
+ user is doing with the pointing devices: these components are always
+ visible throughout the example, and do not interfere with interaction
+ anywhere else. These components are handy for reuse if you ever need to do
+ a video or live demonstration of a user interface.
+
+ Alternatively, some of the individual QML files can be run on the command
+ line with the \l {QML Runtime Tool}{qml tool}, as a quick reminder to see
+ how a particular kind of component can be built.
+
+ \section1 TapHandler
+
+ \image pointerhandlers-example-taphandler.webp
+
+ The "tap" page shows how to detect touchscreen taps, long-presses, and
+ mouse clicks with different buttons. You can also try out the different
+ \l {TapHandler::}{gesturePolicy} values.
+
+ \section2 Multi-tap Buttons
+
+ On this page are three custom \c Button components, with different
+ \l {TapHandler::}{gesturePolicy} values: one button requires you
+ to keep your finger or mouse within the button during the whole time
+ from press to release; one will execute even if you drag outside
+ the button and then drag back in before releasing; and one will
+ exit its pressed state if you drag a little past the
+ \l {QStyleHints::startDragDistance}{system-wide drag threshold}.
+ If you try this example on a touchscreen, you should be able to interact
+ with all three buttons at the same time with different fingers.
+
+ \image pointerhandlers-example-multibutton.webp
+
+ \section1 PointHandler
+
+ On the "single point handler" page, PointHandler provides feedback from
+ some of the properties that can be found in \l SinglePointHandler::point
+ and \l handlerPoint::device. If you have built the example as
+ an executable, you will see this feedback at the same time as the feedback
+ from the PointHandlers in the main pointerhandlers.qml file.
+
+ \image pointerhandlers-example-pointhandler.webp
+
+ The "tablet canvas" page uses PointHandler to uniquely detect different
+ \l {QPointingDevice::PointerType}{types of pointing devices}, so that if
+ you have a drawing tablet connected to your computer, you can draw on the
+ Canvas item with different types of stylus: pen, airbrush or marker. You
+ can "erase" strokes with the stylus eraser (done here by drawing on top
+ with the background color). Several \l {HoverHandler}{HoverHandlers}
+ provide feedback about which type of stylus or eraser is detected.
+
+ \section1 HoverHandler
+
+ The "hover sidebar" page shows how to detect when the mouse is hovering a
+ button component and its container at the same time. The propagation can be
+ disabled by setting the \l HoverHandler::blocking property. You can try out
+ all combinations of HoverHandler and MouseArea here, to compare how they
+ handle hover detection. And one more HoverHandler is used to show the
+ current mouse position in scene coordinates.
+
+ You can also verify that the HoverHandler on the animated "platform"
+ is hovered whenever it slides under the mouse cursor.
+
+ \section1 DragHandler
+
+ The "joystick" page simply has a \l DragHandler dragging an \l Image.
+ A \l State with \l AnchorChanges unlocks the \l anchors so that dragging is
+ possible; and an \l AnchorAnimation animates the knob's return to the
+ center position when released.
+
+ \image pointerhandlers-example-joystick.jpg
+
+ The "fling animation" page demonstrates one use of the
+ DragHandler::centroid::velocity property, which simply makes the value from
+ QEventPoint::velocity() available in QML. The \c MomentumAnimation component
+ that is used in this example shows one way to simulate phyics (momentum and
+ friction) without resorting to heavier solutions.
+
+ \image pointerhandlers-example-fling.webp
+
+ \section1 PinchHandler
+
+ The "pinch" page demonstrates multiple PinchHandlers: some require two
+ fingers and some require three, to perform the usual scaling, rotation and
+ translation, with constraints managed via PinchHandler's axis min and max
+ properties. One of the PinchHandler instances is used to manipulate
+ different \l Rectangle properties rather than position, scale and rotation.
+ Various PinchHandler properties are bound in various ways. You should be
+ able to manipulate each instance uniquely. Some items also have
+ DragHandlers and TapHandlers.
+
+ \image pointerhandlers-example-pinchhandler.webp
+
+ \section1 Interoperability
+
+ \section2 Sliders
+
+ The "mixer" page demonstrates the use of multiple handlers inside a
+ ListView delegate. You can interact with multiple \c Slider components
+ simultaneously, and you can flick the ListView sideways.
+
+ \list
+ \li A DragHandler allows you to start dragging anywhere along the "track"
+ where the slider knob can slide. Because the default \l{DragHandler::}{snapMode}
+ is \c DragHandler.SnapAuto, the knob will \e snap into a position centered
+ under the mouse or touchpoint after you have dragged past the
+ \l {QStyleHints::startDragDistance}{system-wide drag threshold}.
+
+ \li A WheelHandler directly adjusts the \c y property of the knob \l Image.
+
+ \li A BoundaryRule prevents either the DragHandler or the WheelHandler from
+ dragging the knob too far.
+
+ \li A TapHandler provides one more gesture than a typical \c Slider component
+ would have: you can tap on the knob.
+ \endlist
+
+ \image pointerhandlers-example-mixer.webp
+
+ \section2 Map
+
+ The "map" page demonstrates dragging, transformation and re-scaling an
+ \l {Qt SVG}{SVG} \l Image. You should be able to zoom into a particular
+ location on the map; and if the zoom level is changed substantially,
+ \l Image::sourceSize is changed to request the SVG to be re-rendered at a
+ different resolution. Dragging vertically with two fingers activates a
+ DragHandler that manipulates a \l Rotation transform to tilt the map.
+
+ \image pointerhandlers-example-map.webp
+
+ \section2 Fake Flickable
+
+ The "fake Flickable" page contains an attempt to reproduce much of the
+ functionality of \l Flickable using discrete pointer handlers and
+ animations. Flickable is a complex component, but here you can see one way
+ of separating the individual behaviors that it provides, in case you would
+ like to have only part of the functionality without the complexity.
+
+ There's also a slide-out "drawer" component holding a few more
+ pointer-handler-powered controls.
+
+ \image pointerhandlers-example-fakeflickable.jpg
+*/
diff --git a/examples/quick/pointerhandlers/fakeFlickable.qml b/examples/quick/pointerhandlers/fakeFlickable.qml
index b6be729e3c..0c07deedb7 100644
--- a/examples/quick/pointerhandlers/fakeFlickable.qml
+++ b/examples/quick/pointerhandlers/fakeFlickable.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick
import "components"
Rectangle {
diff --git a/examples/quick/pointerhandlers/flingAnimation.qml b/examples/quick/pointerhandlers/flingAnimation.qml
index a2a6a0acd1..d3231ffc41 100644
--- a/examples/quick/pointerhandlers/flingAnimation.qml
+++ b/examples/quick/pointerhandlers/flingAnimation.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick
import "components"
Rectangle {
diff --git a/examples/quick/pointerhandlers/joystick.qml b/examples/quick/pointerhandlers/joystick.qml
index c0445a5e21..5433bf8be9 100644
--- a/examples/quick/pointerhandlers/joystick.qml
+++ b/examples/quick/pointerhandlers/joystick.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick
Item {
width: image.implicitWidth; height: image.implicitHeight
diff --git a/examples/quick/pointerhandlers/map.qml b/examples/quick/pointerhandlers/map.qml
index f54319f8aa..1a25a3b4ca 100644
--- a/examples/quick/pointerhandlers/map.qml
+++ b/examples/quick/pointerhandlers/map.qml
@@ -120,8 +120,6 @@ Item {
target: map
minimumScale: 0.1
maximumScale: 10
- xAxis.enabled: false
- yAxis.enabled: false
onActiveChanged: if (!active) reRenderIfNecessary()
grabPermissions: PinchHandler.TakeOverForbidden // don't allow takeover if pinch has started
}
diff --git a/examples/quick/pointerhandlers/mixer.qml b/examples/quick/pointerhandlers/mixer.qml
index 39cc2974d7..73a39c58f2 100644
--- a/examples/quick/pointerhandlers/mixer.qml
+++ b/examples/quick/pointerhandlers/mixer.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick
import "components"
Rectangle {
diff --git a/examples/quick/pointerhandlers/pinchHandler.qml b/examples/quick/pointerhandlers/pinchHandler.qml
index a4477b0af0..74f0bd5209 100644
--- a/examples/quick/pointerhandlers/pinchHandler.qml
+++ b/examples/quick/pointerhandlers/pinchHandler.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick
import "components"
Rectangle {
diff --git a/examples/quick/pointerhandlers/sidebar.qml b/examples/quick/pointerhandlers/sidebar.qml
index 60c781d46f..a5e1256d0f 100644
--- a/examples/quick/pointerhandlers/sidebar.qml
+++ b/examples/quick/pointerhandlers/sidebar.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.15
+import QtQuick
import "components"
Rectangle {
@@ -201,12 +201,12 @@ Rectangle {
hoverEnabled: true
cursorShape: Qt.ClosedHandCursor
anchors.fill: parent
- }
- Loader {
- objectName: "bottomSidebarLoader"
- sourceComponent: buttonsAndStuff
- anchors.fill: parent
+ Loader {
+ objectName: "bottomSidebarLoader"
+ sourceComponent: buttonsAndStuff
+ anchors.fill: parent
+ }
}
}
diff --git a/examples/quick/pointerhandlers/singlePointHandlerProperties.qml b/examples/quick/pointerhandlers/singlePointHandlerProperties.qml
index 177e8eaaf5..a04bf0fe6c 100644
--- a/examples/quick/pointerhandlers/singlePointHandlerProperties.qml
+++ b/examples/quick/pointerhandlers/singlePointHandlerProperties.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick
Rectangle {
id: root
diff --git a/examples/quick/pointerhandlers/tabletCanvasDrawing.qml b/examples/quick/pointerhandlers/tabletCanvasDrawing.qml
index 5c19bab31a..36630f16aa 100644
--- a/examples/quick/pointerhandlers/tabletCanvasDrawing.qml
+++ b/examples/quick/pointerhandlers/tabletCanvasDrawing.qml
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.15
-import QtQuick.Layouts 1.15
+import QtQuick
+import QtQuick.Layouts
import "components"
Rectangle {
diff --git a/examples/quick/pointerhandlers/tapWithModifiers.qml b/examples/quick/pointerhandlers/tapWithModifiers.qml
index 86b66512da..a38be819be 100644
--- a/examples/quick/pointerhandlers/tapWithModifiers.qml
+++ b/examples/quick/pointerhandlers/tapWithModifiers.qml
@@ -48,7 +48,7 @@
**
****************************************************************************/
-import QtQuick 2.12
+import QtQuick
Item {
width: 200
diff --git a/examples/quick/positioners/positioners-attachedproperties.qml b/examples/quick/positioners/positioners-attachedproperties.qml
index 39607663a6..41f09c978c 100644
--- a/examples/quick/positioners/positioners-attachedproperties.qml
+++ b/examples/quick/positioners/positioners-attachedproperties.qml
@@ -90,14 +90,14 @@ Rectangle {
anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter
text: "Index: " + parent.Positioner.index
- + (parent.Positioner.isFirstItem ? " (First)" : "")
- + (parent.Positioner.isLastItem ? " (Last)" : "")
+ + (parent.Positioner.isFirstItem ? " (First)" : "")
+ + (parent.Positioner.isLastItem ? " (Last)" : "")
}
// When mouse is clicked, display the values of the positioner
MouseArea {
- anchors.fill: parent
- onClicked: column.showInfo(green.Positioner)
+ anchors.fill: parent
+ onClicked: column.showInfo(green.Positioner)
}
}
//! [0]
@@ -113,14 +113,14 @@ Rectangle {
anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter
text: "Index: " + parent.Positioner.index
- + (parent.Positioner.isFirstItem ? " (First)" : "")
- + (parent.Positioner.isLastItem ? " (Last)" : "")
+ + (parent.Positioner.isFirstItem ? " (First)" : "")
+ + (parent.Positioner.isLastItem ? " (Last)" : "")
}
// When mouse is clicked, display the values of the positioner
MouseArea {
- anchors.fill: parent
- onClicked: column.showInfo(blue.Positioner)
+ anchors.fill: parent
+ onClicked: column.showInfo(blue.Positioner)
}
}
@@ -135,14 +135,14 @@ Rectangle {
anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter
text: "Index: " + parent.Positioner.index
- + (parent.Positioner.isFirstItem ? " (First)" : "")
- + (parent.Positioner.isLastItem ? " (Last)" : "")
+ + (parent.Positioner.isFirstItem ? " (First)" : "")
+ + (parent.Positioner.isLastItem ? " (Last)" : "")
}
// When mouse is clicked, display the values of the positioner
MouseArea {
- anchors.fill: parent
- onClicked: column.showInfo(purple.Positioner)
+ anchors.fill: parent
+ onClicked: column.showInfo(purple.Positioner)
}
}
@@ -159,8 +159,8 @@ Rectangle {
anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter
text: "Index: " + parent.Positioner.index
- + (parent.Positioner.isFirstItem ? " (First)" : "")
- + (parent.Positioner.isLastItem ? " (Last)" : "")
+ + (parent.Positioner.isFirstItem ? " (First)" : "")
+ + (parent.Positioner.isLastItem ? " (Last)" : "")
}
}
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/main.cpp b/examples/quick/quickwidgets/qquickviewcomparison/main.cpp
index e40c509829..c0a26eefba 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/main.cpp
+++ b/examples/quick/quickwidgets/qquickviewcomparison/main.cpp
@@ -61,7 +61,7 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
// this example and QQuickWidget are only functional when rendering with OpenGL
- QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi);
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
QCoreApplication::setApplicationName("Qt QQuickView/QQuickWidget Comparison Example");
QCoreApplication::setOrganizationName("QtProject");
diff --git a/examples/quick/quickwidgets/quickwidget/main.cpp b/examples/quick/quickwidgets/quickwidget/main.cpp
index 1c8b21f790..191adcc451 100644
--- a/examples/quick/quickwidgets/quickwidget/main.cpp
+++ b/examples/quick/quickwidgets/quickwidget/main.cpp
@@ -198,7 +198,7 @@ int main(int argc, char **argv)
QApplication app(argc, argv);
// this example and QQuickWidget are only functional when rendering with OpenGL
- QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi);
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
QCoreApplication::setApplicationName("Qt QQuickWidget Example");
QCoreApplication::setOrganizationName("QtProject");
diff --git a/examples/quick/rendercontrol/rendercontrol_d3d11/CMakeLists.txt b/examples/quick/rendercontrol/rendercontrol_d3d11/CMakeLists.txt
index 98da6e317d..1851fba31d 100644
--- a/examples/quick/rendercontrol/rendercontrol_d3d11/CMakeLists.txt
+++ b/examples/quick/rendercontrol/rendercontrol_d3d11/CMakeLists.txt
@@ -6,8 +6,6 @@ project(rendercontrol_d3d11 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")
@@ -15,21 +13,14 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/rendercontrol/rendercontrol_d3d11")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
+find_package(Qt6 COMPONENTS Core Gui Quick Qml)
-qt_add_executable(rendercontrol_d3d11
- engine.cpp engine.h
+qt_add_executable(rendercontrol_d3d11example WIN32 MACOSX_BUNDLE
+ engine.cpp
main.cpp
- window.cpp window.h
+ window.cpp
)
-set_target_properties(rendercontrol_d3d11 PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(rendercontrol_d3d11 PUBLIC
+target_link_libraries(rendercontrol_d3d11example PUBLIC
Qt::Core
Qt::Gui
Qt::Qml
@@ -42,18 +33,14 @@ target_link_libraries(rendercontrol_d3d11 PUBLIC
# Resources:
-set(rendercontrol_resource_files
- "demo.qml"
-)
-
-qt6_add_resources(rendercontrol_d3d11 "rendercontrol"
- PREFIX
- "/rendercontrol"
- FILES
- ${rendercontrol_resource_files}
+qt_add_qml_module(rendercontrol_d3d11example
+ URI rendercontrol
+ VERSION 1.0
+ QML_FILES
+ "demo.qml"
)
-install(TARGETS rendercontrol_d3d11
+install(TARGETS rendercontrol_d3d11example
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/quick/rendercontrol/rendercontrol_d3d11/demo.qml b/examples/quick/rendercontrol/rendercontrol_d3d11/demo.qml
index 32e2f423d1..d724d6304b 100644
--- a/examples/quick/rendercontrol/rendercontrol_d3d11/demo.qml
+++ b/examples/quick/rendercontrol/rendercontrol_d3d11/demo.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
diff --git a/examples/quick/rendercontrol/rendercontrol_d3d11/main.cpp b/examples/quick/rendercontrol/rendercontrol_d3d11/main.cpp
index 119b289500..defb080a91 100644
--- a/examples/quick/rendercontrol/rendercontrol_d3d11/main.cpp
+++ b/examples/quick/rendercontrol/rendercontrol_d3d11/main.cpp
@@ -64,7 +64,7 @@ int main(int argc, char **argv)
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
// only functional when Qt Quick is also using D3D11
- QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D11Rhi);
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D11);
Engine engine;
if (!engine.create())
diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/CMakeLists.txt b/examples/quick/rendercontrol/rendercontrol_opengl/CMakeLists.txt
index 2ac8eaf1eb..e15de24f08 100644
--- a/examples/quick/rendercontrol/rendercontrol_opengl/CMakeLists.txt
+++ b/examples/quick/rendercontrol/rendercontrol_opengl/CMakeLists.txt
@@ -1,13 +1,9 @@
-# Generated from rendercontrol_opengl.pro.
-
cmake_minimum_required(VERSION 3.16)
project(rendercontrol_opengl 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")
@@ -15,22 +11,14 @@ endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/rendercontrol/rendercontrol_opengl")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS OpenGL)
+find_package(Qt6 COMPONENTS Core Gui Quick Qml OpenGL)
-qt_add_executable(rendercontrol_opengl
- cuberenderer.cpp cuberenderer.h
+qt_add_executable(rendercontrol_openglexample WIN32 MACOSX_BUNDLE
+ cuberenderer.cpp
main.cpp
- window_singlethreaded.cpp window_singlethreaded.h
-)
-set_target_properties(rendercontrol_opengl PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
+ window_singlethreaded.cpp
)
-target_link_libraries(rendercontrol_opengl PUBLIC
+target_link_libraries(rendercontrol_openglexample PUBLIC
Qt::Core
Qt::Gui
Qt::OpenGL
@@ -38,20 +26,15 @@ target_link_libraries(rendercontrol_opengl PUBLIC
Qt::Quick
)
-
# Resources:
-set(rendercontrol_resource_files
- "demo.qml"
-)
-
-qt6_add_resources(rendercontrol_opengl "rendercontrol"
- PREFIX
- "/rendercontrol"
- FILES
- ${rendercontrol_resource_files}
+qt_add_qml_module(rendercontrol_openglexample
+ URI rendercontrol
+ VERSION 1.0
+ QML_FILES
+ "demo.qml"
)
-install(TARGETS rendercontrol_opengl
+install(TARGETS rendercontrol_openglexample
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/demo.qml b/examples/quick/rendercontrol/rendercontrol_opengl/demo.qml
index 0312c2ec1c..6fad1c5ef5 100644
--- a/examples/quick/rendercontrol/rendercontrol_opengl/demo.qml
+++ b/examples/quick/rendercontrol/rendercontrol_opengl/demo.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -48,8 +48,8 @@
**
****************************************************************************/
-import QtQuick 2.0
-import QtQuick.Particles 2.0
+import QtQuick
+import QtQuick.Particles
Rectangle {
id: root
diff --git a/examples/quick/rendercontrol/rendercontrol_opengl/main.cpp b/examples/quick/rendercontrol/rendercontrol_opengl/main.cpp
index 11db82773b..e0315cef38 100644
--- a/examples/quick/rendercontrol/rendercontrol_opengl/main.cpp
+++ b/examples/quick/rendercontrol/rendercontrol_opengl/main.cpp
@@ -57,7 +57,7 @@ int main(int argc, char **argv)
QGuiApplication app(argc, argv);
// only functional when Qt Quick is also using OpenGL
- QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi);
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
WindowSingleThreaded window;
window.resize(1024, 768);
diff --git a/examples/quick/scenegraph/d3d11underqml/d3d11squircle.cpp b/examples/quick/scenegraph/d3d11underqml/d3d11squircle.cpp
index 9acfbfff23..ef46c6361d 100644
--- a/examples/quick/scenegraph/d3d11underqml/d3d11squircle.cpp
+++ b/examples/quick/scenegraph/d3d11underqml/d3d11squircle.cpp
@@ -210,7 +210,7 @@ void SquircleRenderer::frameStart()
QSGRendererInterface *rif = m_window->rendererInterface();
// We are not prepared for anything other than running with the RHI and its D3D11 backend.
- Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::Direct3D11Rhi);
+ Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::Direct3D11);
m_device = reinterpret_cast<ID3D11Device *>(rif->getResource(m_window, QSGRendererInterface::DeviceResource));
Q_ASSERT(m_device);
diff --git a/examples/quick/scenegraph/d3d11underqml/main.cpp b/examples/quick/scenegraph/d3d11underqml/main.cpp
index f2a224c1a2..c225fe9df7 100644
--- a/examples/quick/scenegraph/d3d11underqml/main.cpp
+++ b/examples/quick/scenegraph/d3d11underqml/main.cpp
@@ -56,7 +56,7 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D11Rhi);
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::Direct3D11);
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
diff --git a/examples/quick/scenegraph/fboitem/main.cpp b/examples/quick/scenegraph/fboitem/main.cpp
index 61510cdb93..f7fea90f6c 100644
--- a/examples/quick/scenegraph/fboitem/main.cpp
+++ b/examples/quick/scenegraph/fboitem/main.cpp
@@ -58,7 +58,7 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi);
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
diff --git a/examples/quick/scenegraph/graph/noisynode.cpp b/examples/quick/scenegraph/graph/noisynode.cpp
index f8b72bfe67..b9a9b6b1ae 100644
--- a/examples/quick/scenegraph/graph/noisynode.cpp
+++ b/examples/quick/scenegraph/graph/noisynode.cpp
@@ -151,6 +151,7 @@ void NoisyShader::updateSampledImage(RenderState &state, int binding, QSGTexture
Q_UNUSED(binding);
NoisyMaterial *mat = static_cast<NoisyMaterial *>(newMaterial);
+ mat->state.texture->commitTextureOperations(state.rhi(), state.resourceUpdateBatch());
*texture = mat->state.texture;
}
diff --git a/examples/quick/scenegraph/metaltextureimport/main.cpp b/examples/quick/scenegraph/metaltextureimport/main.cpp
index 2abc1c5671..9fb9d9ba12 100644
--- a/examples/quick/scenegraph/metaltextureimport/main.cpp
+++ b/examples/quick/scenegraph/metaltextureimport/main.cpp
@@ -54,7 +54,7 @@
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- QQuickWindow::setGraphicsApi(QSGRendererInterface::MetalRhi);
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::Metal);
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
diff --git a/examples/quick/scenegraph/metalunderqml/main.cpp b/examples/quick/scenegraph/metalunderqml/main.cpp
index 4a657a6bf4..220bed14f8 100644
--- a/examples/quick/scenegraph/metalunderqml/main.cpp
+++ b/examples/quick/scenegraph/metalunderqml/main.cpp
@@ -56,7 +56,7 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- QQuickWindow::setGraphicsApi(QSGRendererInterface::MetalRhi);
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::Metal);
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
diff --git a/examples/quick/scenegraph/metalunderqml/metalsquircle.mm b/examples/quick/scenegraph/metalunderqml/metalsquircle.mm
index 4acedcab02..edac29665c 100644
--- a/examples/quick/scenegraph/metalunderqml/metalsquircle.mm
+++ b/examples/quick/scenegraph/metalunderqml/metalsquircle.mm
@@ -205,7 +205,7 @@ void SquircleRenderer::frameStart()
QSGRendererInterface *rif = m_window->rendererInterface();
// We are not prepared for anything other than running with the RHI and its Metal backend.
- Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::MetalRhi);
+ Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::Metal);
m_device = (id<MTLDevice>) rif->getResource(m_window, QSGRendererInterface::DeviceResource);
Q_ASSERT(m_device);
diff --git a/examples/quick/scenegraph/openglunderqml/main.cpp b/examples/quick/scenegraph/openglunderqml/main.cpp
index d92cbb2d80..5df329c425 100644
--- a/examples/quick/scenegraph/openglunderqml/main.cpp
+++ b/examples/quick/scenegraph/openglunderqml/main.cpp
@@ -59,7 +59,7 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGLRhi);
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp
index d80309cbfb..2e224e77b0 100644
--- a/examples/quick/scenegraph/openglunderqml/squircle.cpp
+++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp
@@ -137,7 +137,7 @@ void SquircleRenderer::init()
{
if (!m_program) {
QSGRendererInterface *rif = m_window->rendererInterface();
- Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::OpenGL || rif->graphicsApi() == QSGRendererInterface::OpenGLRhi);
+ Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::OpenGL);
initializeOpenGLFunctions();
diff --git a/examples/quick/scenegraph/vulkantextureimport/main.cpp b/examples/quick/scenegraph/vulkantextureimport/main.cpp
index d2eb5184dc..290eccdc42 100644
--- a/examples/quick/scenegraph/vulkantextureimport/main.cpp
+++ b/examples/quick/scenegraph/vulkantextureimport/main.cpp
@@ -55,7 +55,7 @@ int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
- QQuickWindow::setGraphicsApi(QSGRendererInterface::VulkanRhi);
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::Vulkan);
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
diff --git a/examples/quick/scenegraph/vulkanunderqml/main.cpp b/examples/quick/scenegraph/vulkanunderqml/main.cpp
index e4a3f36ca7..112332f4fd 100644
--- a/examples/quick/scenegraph/vulkanunderqml/main.cpp
+++ b/examples/quick/scenegraph/vulkanunderqml/main.cpp
@@ -56,7 +56,7 @@ int main(int argc, char **argv)
QGuiApplication app(argc, argv);
// This example needs Vulkan. It will not run otherwise.
- QQuickWindow::setGraphicsApi(QSGRendererInterface::VulkanRhi);
+ QQuickWindow::setGraphicsApi(QSGRendererInterface::Vulkan);
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
diff --git a/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp b/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp
index 5942b49843..f272570d03 100644
--- a/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp
+++ b/examples/quick/scenegraph/vulkanunderqml/vulkansquircle.cpp
@@ -205,7 +205,7 @@ void SquircleRenderer::frameStart()
QSGRendererInterface *rif = m_window->rendererInterface();
// We are not prepared for anything other than running with the RHI and its Vulkan backend.
- Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::VulkanRhi);
+ Q_ASSERT(rif->graphicsApi() == QSGRendererInterface::Vulkan);
if (m_vert.isEmpty())
prepareShader(VertexStage);
diff --git a/examples/quick/tutorials/dynamicview/CMakeLists.txt b/examples/quick/tutorials/dynamicview/CMakeLists.txt
index 815b9f5a74..38f8e7907b 100644
--- a/examples/quick/tutorials/dynamicview/CMakeLists.txt
+++ b/examples/quick/tutorials/dynamicview/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_subdirectory(dynamicview1)
-add_subdirectory(dynamicview2)
-add_subdirectory(dynamicview3)
-add_subdirectory(dynamicview4)
+qt_internal_add_example(dynamicview1)
+qt_internal_add_example(dynamicview2)
+qt_internal_add_example(dynamicview3)
+qt_internal_add_example(dynamicview4)
diff --git a/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml b/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml
index 60167aa813..228dc4b56f 100644
--- a/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml
+++ b/examples/quick/tutorials/dynamicview/dynamicview1/dynamicview.qml
@@ -63,7 +63,7 @@ Rectangle {
Rectangle {
id: content
- anchors { left: parent.left; right: parent.right }
+ width: ListView.view.width
height: column.implicitHeight + 4
border.width: 1
diff --git a/examples/quick/tutorials/samegame/CMakeLists.txt b/examples/quick/tutorials/samegame/CMakeLists.txt
index e0d5157a2c..df1a825651 100644
--- a/examples/quick/tutorials/samegame/CMakeLists.txt
+++ b/examples/quick/tutorials/samegame/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_subdirectory(samegame1)
-add_subdirectory(samegame2)
-add_subdirectory(samegame3)
-add_subdirectory(samegame4)
+qt_internal_add_example(samegame1)
+qt_internal_add_example(samegame2)
+qt_internal_add_example(samegame3)
+qt_internal_add_example(samegame4)
diff --git a/examples/quickcontrols2/CMakeLists.txt b/examples/quickcontrols2/CMakeLists.txt
index 7ca535e9ef..4c3c54b032 100644
--- a/examples/quickcontrols2/CMakeLists.txt
+++ b/examples/quickcontrols2/CMakeLists.txt
@@ -1,14 +1,14 @@
# Generated from quickcontrols2.pro.
-add_subdirectory(gallery)
+qt_internal_add_example(gallery)
add_subdirectory(chattutorial)
-add_subdirectory(texteditor)
-add_subdirectory(contactlist)
-add_subdirectory(sidepanel)
-add_subdirectory(swipetoremove)
-add_subdirectory(wearable)
-add_subdirectory(imagine/automotive)
-add_subdirectory(imagine/musicplayer)
+qt_internal_add_example(texteditor)
+qt_internal_add_example(contactlist)
+qt_internal_add_example(sidepanel)
+qt_internal_add_example(swipetoremove)
+qt_internal_add_example(wearable)
+qt_internal_add_example(imagine/automotive)
+qt_internal_add_example(imagine/musicplayer)
if(TARGET Qt::Widgets)
- add_subdirectory(flatstyle)
+ qt_internal_add_example(flatstyle)
endif()
diff --git a/examples/quickcontrols2/chattutorial/CMakeLists.txt b/examples/quickcontrols2/chattutorial/CMakeLists.txt
index 9bfd799492..88f9cb5cf2 100644
--- a/examples/quickcontrols2/chattutorial/CMakeLists.txt
+++ b/examples/quickcontrols2/chattutorial/CMakeLists.txt
@@ -1,10 +1,10 @@
# Generated from chattutorial.pro.
-add_subdirectory(chapter1-settingup)
-add_subdirectory(chapter2-lists)
-add_subdirectory(chapter3-navigation)
+qt_internal_add_example(chapter1)
+qt_internal_add_example(chapter2)
+qt_internal_add_example(chapter3)
if (TARGET Qt::Sql)
- add_subdirectory(chapter4-models)
- add_subdirectory(chapter5-styling)
+ qt_internal_add_example(chapter4)
+ qt_internal_add_example(chapter5)
endif()
diff --git a/examples/quickcontrols2/chattutorial/chapter1-settingup/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter1-settingup/CMakeLists.txt
deleted file mode 100644
index 00cf9f6025..0000000000
--- a/examples/quickcontrols2/chattutorial/chapter1-settingup/CMakeLists.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-# Generated from chapter1-settingup.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(chapter1-settingup 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}/quickcontrols2/chattutorial/chapter1-settingup")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
-
-qt_add_executable(chapter1-settingup
- main.cpp
-)
-set_target_properties(chapter1-settingup PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(chapter1-settingup PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
-)
-
-
-# Resources:
-set(qml_resource_files
- "main.qml"
-)
-
-qt6_add_resources(chapter1-settingup "qml"
- PREFIX
- "/"
- FILES
- ${qml_resource_files}
-)
-
-install(TARGETS chapter1-settingup
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/quickcontrols2/chattutorial/chapter1-settingup/qml.qrc b/examples/quickcontrols2/chattutorial/chapter1-settingup/qml.qrc
deleted file mode 100644
index 0ff3892d9c..0000000000
--- a/examples/quickcontrols2/chattutorial/chapter1-settingup/qml.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- </qresource>
-</RCC>
-
diff --git a/examples/quickcontrols2/chattutorial/chapter1/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter1/CMakeLists.txt
new file mode 100644
index 0000000000..4b8770a83d
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter1/CMakeLists.txt
@@ -0,0 +1,44 @@
+cmake_minimum_required(VERSION 3.16)
+project(chapter1 LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter1")
+
+find_package(Qt6 COMPONENTS Core Gui Qml Quick)
+
+qt_add_executable(chattutorial-chapter1 WIN32 MACOSX_BUNDLE
+ main.cpp
+)
+target_link_libraries(chattutorial-chapter1 PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+)
+
+qt_add_qml_module(chattutorial-chapter1
+ URI chapter1
+ VERSION 1.0
+ QML_FILES
+ "main.qml"
+)
+
+qt6_add_resources(chattutorial-chapter1 "conf"
+ PREFIX
+ "/"
+ FILES
+ "qtquickcontrols2.conf"
+)
+
+install(TARGETS chattutorial-chapter1
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/quickcontrols2/chattutorial/chapter1-settingup/chapter1-settingup.pro b/examples/quickcontrols2/chattutorial/chapter1/chapter1.pro
index 6b7e71082c..6b50809f20 100644
--- a/examples/quickcontrols2/chattutorial/chapter1-settingup/chapter1-settingup.pro
+++ b/examples/quickcontrols2/chattutorial/chapter1/chapter1.pro
@@ -5,7 +5,10 @@ CONFIG += c++11
SOURCES += main.cpp
-RESOURCES += qml.qrc
+resources.files = main.qml
+resources.prefix = chapter1/
+RESOURCES += resources \
+ qtquickcontrols2.conf
-target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter1-settingup
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter1
INSTALLS += target
diff --git a/examples/quickcontrols2/chattutorial/chapter3-navigation/main.cpp b/examples/quickcontrols2/chattutorial/chapter1/main.cpp
index ea20c89012..ca175ccf9c 100644
--- a/examples/quickcontrols2/chattutorial/chapter3-navigation/main.cpp
+++ b/examples/quickcontrols2/chattutorial/chapter1/main.cpp
@@ -56,7 +56,7 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ engine.load(QUrl(QStringLiteral("qrc:/chapter1/main.qml")));
return app.exec();
}
diff --git a/examples/quickcontrols2/chattutorial/chapter1-settingup/main.qml b/examples/quickcontrols2/chattutorial/chapter1/main.qml
index 3dc93e47d0..3dc93e47d0 100644
--- a/examples/quickcontrols2/chattutorial/chapter1-settingup/main.qml
+++ b/examples/quickcontrols2/chattutorial/chapter1/main.qml
diff --git a/examples/quickcontrols2/chattutorial/chapter1/qtquickcontrols2.conf b/examples/quickcontrols2/chattutorial/chapter1/qtquickcontrols2.conf
new file mode 100644
index 0000000000..db9486764e
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter1/qtquickcontrols2.conf
@@ -0,0 +1,2 @@
+[Controls]
+Style=Basic
diff --git a/examples/quickcontrols2/chattutorial/chapter2-lists/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter2-lists/CMakeLists.txt
deleted file mode 100644
index 9bc55dad96..0000000000
--- a/examples/quickcontrols2/chattutorial/chapter2-lists/CMakeLists.txt
+++ /dev/null
@@ -1,77 +0,0 @@
-# Generated from chapter2-lists.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(chapter2-lists 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}/quickcontrols2/chattutorial/chapter2-lists")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
-
-qt_add_executable(chapter2-lists
- main.cpp
-)
-set_target_properties(chapter2-lists PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(chapter2-lists PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
-)
-
-
-# Resources:
-set(qml_resource_files
- "main.qml"
-)
-
-qt6_add_resources(chapter2-lists "qml"
- PREFIX
- "/"
- FILES
- ${qml_resource_files}
-)
-set(shared_resource_files
- "../shared/Albert_Einstein.png"
- "../shared/Albert_Einstein@2x.png"
- "../shared/Albert_Einstein@3x.png"
- "../shared/Albert_Einstein@4x.png"
- "../shared/Ernest_Hemingway.png"
- "../shared/Ernest_Hemingway@2x.png"
- "../shared/Ernest_Hemingway@3x.png"
- "../shared/Ernest_Hemingway@4x.png"
- "../shared/Hans_Gude.png"
- "../shared/Hans_Gude@2x.png"
- "../shared/Hans_Gude@3x.png"
- "../shared/Hans_Gude@4x.png"
-)
-
-qt6_add_resources(chapter2-lists "shared"
- PREFIX
- "/"
- BASE
- "../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS chapter2-lists
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/quickcontrols2/chattutorial/chapter2-lists/chapter2-lists.pro b/examples/quickcontrols2/chattutorial/chapter2-lists/chapter2-lists.pro
deleted file mode 100644
index dff0aac2b1..0000000000
--- a/examples/quickcontrols2/chattutorial/chapter2-lists/chapter2-lists.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TEMPLATE = app
-
-QT += qml quick
-CONFIG += c++11
-
-SOURCES += main.cpp
-
-RESOURCES += qml.qrc \
- ../shared/shared.qrc
-
-target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter2-lists
-INSTALLS += target
diff --git a/examples/quickcontrols2/chattutorial/chapter2-lists/qml.qrc b/examples/quickcontrols2/chattutorial/chapter2-lists/qml.qrc
deleted file mode 100644
index 0ff3892d9c..0000000000
--- a/examples/quickcontrols2/chattutorial/chapter2-lists/qml.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- </qresource>
-</RCC>
-
diff --git a/examples/quickcontrols2/chattutorial/chapter2/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter2/CMakeLists.txt
new file mode 100644
index 0000000000..5c73c212ce
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter2/CMakeLists.txt
@@ -0,0 +1,57 @@
+cmake_minimum_required(VERSION 3.16)
+project(chapter2 LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter2")
+
+find_package(Qt6 COMPONENTS Core Gui Qml Quick)
+
+qt_add_executable(chattutorial-chapter2 WIN32 MACOSX_BUNDLE
+ main.cpp
+)
+target_link_libraries(chattutorial-chapter2 PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+)
+
+qt_add_qml_module(chattutorial-chapter2
+ URI chapter2
+ VERSION 1.0
+ QML_FILES
+ "main.qml"
+ RESOURCES
+ "images/Albert_Einstein.png"
+ "images/Albert_Einstein@2x.png"
+ "images/Albert_Einstein@3x.png"
+ "images/Albert_Einstein@4x.png"
+ "images/Ernest_Hemingway.png"
+ "images/Ernest_Hemingway@2x.png"
+ "images/Ernest_Hemingway@3x.png"
+ "images/Ernest_Hemingway@4x.png"
+ "images/Hans_Gude.png"
+ "images/Hans_Gude@2x.png"
+ "images/Hans_Gude@3x.png"
+ "images/Hans_Gude@4x.png"
+)
+
+qt6_add_resources(chattutorial-chapter2 "conf"
+ PREFIX
+ "/"
+ FILES
+ "qtquickcontrols2.conf"
+)
+
+install(TARGETS chattutorial-chapter2
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro b/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro
new file mode 100644
index 0000000000..15429b7c89
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter2/chapter2.pro
@@ -0,0 +1,27 @@
+TEMPLATE = app
+
+QT += qml quick
+CONFIG += c++11
+
+SOURCES += main.cpp
+
+resources.files = \
+ images/Albert_Einstein.png \
+ images/Albert_Einstein@2x.png \
+ images/Albert_Einstein@3x.png \
+ images/Albert_Einstein@4x.png \
+ images/Ernest_Hemingway.png \
+ images/Ernest_Hemingway@2x.png \
+ images/Ernest_Hemingway@3x.png \
+ images/Ernest_Hemingway@4x.png \
+ images/Hans_Gude.png \
+ images/Hans_Gude@2x.png \
+ images/Hans_Gude@3x.png \
+ images/Hans_Gude@4x.png \
+ main.qml
+resources.prefix = chapter2/
+RESOURCES += resources \
+ qtquickcontrols2.conf
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter2
+INSTALLS += target
diff --git a/examples/quickcontrols2/chattutorial/shared/Albert_Einstein.png b/examples/quickcontrols2/chattutorial/chapter2/images/Albert_Einstein.png
index 7c44b90b8d..7c44b90b8d 100644
--- a/examples/quickcontrols2/chattutorial/shared/Albert_Einstein.png
+++ b/examples/quickcontrols2/chattutorial/chapter2/images/Albert_Einstein.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/shared/Albert_Einstein@2x.png b/examples/quickcontrols2/chattutorial/chapter2/images/Albert_Einstein@2x.png
index 6ce9c39b6c..6ce9c39b6c 100644
--- a/examples/quickcontrols2/chattutorial/shared/Albert_Einstein@2x.png
+++ b/examples/quickcontrols2/chattutorial/chapter2/images/Albert_Einstein@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/shared/Albert_Einstein@3x.png b/examples/quickcontrols2/chattutorial/chapter2/images/Albert_Einstein@3x.png
index aab6a6a162..aab6a6a162 100644
--- a/examples/quickcontrols2/chattutorial/shared/Albert_Einstein@3x.png
+++ b/examples/quickcontrols2/chattutorial/chapter2/images/Albert_Einstein@3x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/shared/Albert_Einstein@4x.png b/examples/quickcontrols2/chattutorial/chapter2/images/Albert_Einstein@4x.png
index 3611284df4..3611284df4 100644
--- a/examples/quickcontrols2/chattutorial/shared/Albert_Einstein@4x.png
+++ b/examples/quickcontrols2/chattutorial/chapter2/images/Albert_Einstein@4x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/shared/Ernest_Hemingway.png b/examples/quickcontrols2/chattutorial/chapter2/images/Ernest_Hemingway.png
index 3ac8992fd9..3ac8992fd9 100644
--- a/examples/quickcontrols2/chattutorial/shared/Ernest_Hemingway.png
+++ b/examples/quickcontrols2/chattutorial/chapter2/images/Ernest_Hemingway.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/shared/Ernest_Hemingway@2x.png b/examples/quickcontrols2/chattutorial/chapter2/images/Ernest_Hemingway@2x.png
index 122d9f1e53..122d9f1e53 100644
--- a/examples/quickcontrols2/chattutorial/shared/Ernest_Hemingway@2x.png
+++ b/examples/quickcontrols2/chattutorial/chapter2/images/Ernest_Hemingway@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/shared/Ernest_Hemingway@3x.png b/examples/quickcontrols2/chattutorial/chapter2/images/Ernest_Hemingway@3x.png
index 2fe9c2cc1c..2fe9c2cc1c 100644
--- a/examples/quickcontrols2/chattutorial/shared/Ernest_Hemingway@3x.png
+++ b/examples/quickcontrols2/chattutorial/chapter2/images/Ernest_Hemingway@3x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/shared/Ernest_Hemingway@4x.png b/examples/quickcontrols2/chattutorial/chapter2/images/Ernest_Hemingway@4x.png
index 96fb6788b5..96fb6788b5 100644
--- a/examples/quickcontrols2/chattutorial/shared/Ernest_Hemingway@4x.png
+++ b/examples/quickcontrols2/chattutorial/chapter2/images/Ernest_Hemingway@4x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/shared/Hans_Gude.png b/examples/quickcontrols2/chattutorial/chapter2/images/Hans_Gude.png
index 907e38bc61..907e38bc61 100644
--- a/examples/quickcontrols2/chattutorial/shared/Hans_Gude.png
+++ b/examples/quickcontrols2/chattutorial/chapter2/images/Hans_Gude.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/shared/Hans_Gude@2x.png b/examples/quickcontrols2/chattutorial/chapter2/images/Hans_Gude@2x.png
index 6837796a83..6837796a83 100644
--- a/examples/quickcontrols2/chattutorial/shared/Hans_Gude@2x.png
+++ b/examples/quickcontrols2/chattutorial/chapter2/images/Hans_Gude@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/shared/Hans_Gude@3x.png b/examples/quickcontrols2/chattutorial/chapter2/images/Hans_Gude@3x.png
index 29af422ad3..29af422ad3 100644
--- a/examples/quickcontrols2/chattutorial/shared/Hans_Gude@3x.png
+++ b/examples/quickcontrols2/chattutorial/chapter2/images/Hans_Gude@3x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/shared/Hans_Gude@4x.png b/examples/quickcontrols2/chattutorial/chapter2/images/Hans_Gude@4x.png
index bc35eeaa79..bc35eeaa79 100644
--- a/examples/quickcontrols2/chattutorial/shared/Hans_Gude@4x.png
+++ b/examples/quickcontrols2/chattutorial/chapter2/images/Hans_Gude@4x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/shared/shared.qrc b/examples/quickcontrols2/chattutorial/chapter2/images/images.qrc
index 9eda6aa29c..9eda6aa29c 100644
--- a/examples/quickcontrols2/chattutorial/shared/shared.qrc
+++ b/examples/quickcontrols2/chattutorial/chapter2/images/images.qrc
diff --git a/examples/quickcontrols2/chattutorial/chapter1-settingup/main.cpp b/examples/quickcontrols2/chattutorial/chapter2/main.cpp
index ea20c89012..55997aa8ad 100644
--- a/examples/quickcontrols2/chattutorial/chapter1-settingup/main.cpp
+++ b/examples/quickcontrols2/chattutorial/chapter2/main.cpp
@@ -56,7 +56,7 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ engine.load(QUrl(QStringLiteral("qrc:/chapter2/main.qml")));
return app.exec();
}
diff --git a/examples/quickcontrols2/chattutorial/chapter2-lists/main.qml b/examples/quickcontrols2/chattutorial/chapter2/main.qml
index 66a51d2db2..8a87d41020 100644
--- a/examples/quickcontrols2/chattutorial/chapter2-lists/main.qml
+++ b/examples/quickcontrols2/chattutorial/chapter2/main.qml
@@ -83,7 +83,7 @@ ApplicationWindow {
Image {
id: avatar
- source: "qrc:/" + modelData.replace(" ", "_") + ".png"
+ source: "images/" + modelData.replace(" ", "_") + ".png"
}
}
}
diff --git a/examples/quickcontrols2/chattutorial/chapter2/qtquickcontrols2.conf b/examples/quickcontrols2/chattutorial/chapter2/qtquickcontrols2.conf
new file mode 100644
index 0000000000..db9486764e
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter2/qtquickcontrols2.conf
@@ -0,0 +1,2 @@
+[Controls]
+Style=Basic
diff --git a/examples/quickcontrols2/chattutorial/chapter3-navigation/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter3-navigation/CMakeLists.txt
deleted file mode 100644
index 6c258e709b..0000000000
--- a/examples/quickcontrols2/chattutorial/chapter3-navigation/CMakeLists.txt
+++ /dev/null
@@ -1,79 +0,0 @@
-# Generated from chapter3-navigation.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(chapter3-navigation 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}/quickcontrols2/chattutorial/chapter3-navigation")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
-
-qt_add_executable(chapter3-navigation
- main.cpp
-)
-set_target_properties(chapter3-navigation PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(chapter3-navigation PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
-)
-
-
-# Resources:
-set(qml_resource_files
- "ContactPage.qml"
- "ConversationPage.qml"
- "main.qml"
-)
-
-qt6_add_resources(chapter3-navigation "qml"
- PREFIX
- "/"
- FILES
- ${qml_resource_files}
-)
-set(shared_resource_files
- "../shared/Albert_Einstein.png"
- "../shared/Albert_Einstein@2x.png"
- "../shared/Albert_Einstein@3x.png"
- "../shared/Albert_Einstein@4x.png"
- "../shared/Ernest_Hemingway.png"
- "../shared/Ernest_Hemingway@2x.png"
- "../shared/Ernest_Hemingway@3x.png"
- "../shared/Ernest_Hemingway@4x.png"
- "../shared/Hans_Gude.png"
- "../shared/Hans_Gude@2x.png"
- "../shared/Hans_Gude@3x.png"
- "../shared/Hans_Gude@4x.png"
-)
-
-qt6_add_resources(chapter3-navigation "shared"
- PREFIX
- "/"
- BASE
- "../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS chapter3-navigation
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/quickcontrols2/chattutorial/chapter3-navigation/chapter3-navigation.pro b/examples/quickcontrols2/chattutorial/chapter3-navigation/chapter3-navigation.pro
deleted file mode 100644
index 92736a651d..0000000000
--- a/examples/quickcontrols2/chattutorial/chapter3-navigation/chapter3-navigation.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-TEMPLATE = app
-
-QT += qml quick
-CONFIG += c++11
-
-SOURCES += main.cpp
-
-RESOURCES += qml.qrc \
- ../shared/shared.qrc
-
-target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter3-navigation
-INSTALLS += target
diff --git a/examples/quickcontrols2/chattutorial/chapter3-navigation/qml.qrc b/examples/quickcontrols2/chattutorial/chapter3-navigation/qml.qrc
deleted file mode 100644
index a72e1b7134..0000000000
--- a/examples/quickcontrols2/chattutorial/chapter3-navigation/qml.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- <file>ContactPage.qml</file>
- <file>ConversationPage.qml</file>
- </qresource>
-</RCC>
diff --git a/examples/quickcontrols2/chattutorial/chapter3/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter3/CMakeLists.txt
new file mode 100644
index 0000000000..e835d38ac9
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/CMakeLists.txt
@@ -0,0 +1,60 @@
+cmake_minimum_required(VERSION 3.16)
+project(chapter3 LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter3")
+
+find_package(Qt6 COMPONENTS Core Gui Qml Quick)
+
+qt_add_executable(chattutorial-chapter3 WIN32 MACOSX_BUNDLE
+ main.cpp
+)
+target_link_libraries(chattutorial-chapter3 PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+)
+
+# Resources:
+qt_add_qml_module(chattutorial-chapter3
+ URI chapter3
+ VERSION 1.0
+ QML_FILES
+ "ContactPage.qml"
+ "ConversationPage.qml"
+ "main.qml"
+ RESOURCES
+ "images/Albert_Einstein.png"
+ "images/Albert_Einstein@2x.png"
+ "images/Albert_Einstein@3x.png"
+ "images/Albert_Einstein@4x.png"
+ "images/Ernest_Hemingway.png"
+ "images/Ernest_Hemingway@2x.png"
+ "images/Ernest_Hemingway@3x.png"
+ "images/Ernest_Hemingway@4x.png"
+ "images/Hans_Gude.png"
+ "images/Hans_Gude@2x.png"
+ "images/Hans_Gude@3x.png"
+ "images/Hans_Gude@4x.png"
+)
+
+qt6_add_resources(chattutorial-chapter3 "conf"
+ PREFIX
+ "/"
+ FILES
+ "qtquickcontrols2.conf"
+)
+
+install(TARGETS chattutorial-chapter3
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/quickcontrols2/chattutorial/chapter3-navigation/ContactPage.qml b/examples/quickcontrols2/chattutorial/chapter3/ContactPage.qml
index 080d8bdb30..b0be22718e 100644
--- a/examples/quickcontrols2/chattutorial/chapter3-navigation/ContactPage.qml
+++ b/examples/quickcontrols2/chattutorial/chapter3/ContactPage.qml
@@ -76,11 +76,11 @@ Page {
width: listView.width - listView.leftMargin - listView.rightMargin
height: avatar.implicitHeight
leftPadding: avatar.implicitWidth + 32
- onClicked: root.StackView.view.push("qrc:/ConversationPage.qml", { inConversationWith: modelData })
+ onClicked: root.StackView.view.push("ConversationPage.qml", { inConversationWith: modelData })
Image {
id: avatar
- source: "qrc:/" + modelData.replace(" ", "_") + ".png"
+ source: "images/" + modelData.replace(" ", "_") + ".png"
}
}
}
diff --git a/examples/quickcontrols2/chattutorial/chapter3-navigation/ConversationPage.qml b/examples/quickcontrols2/chattutorial/chapter3/ConversationPage.qml
index 2ae56444c7..2ae56444c7 100644
--- a/examples/quickcontrols2/chattutorial/chapter3-navigation/ConversationPage.qml
+++ b/examples/quickcontrols2/chattutorial/chapter3/ConversationPage.qml
diff --git a/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro b/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro
new file mode 100644
index 0000000000..42adc69fe9
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/chapter3.pro
@@ -0,0 +1,29 @@
+TEMPLATE = app
+
+QT += qml quick
+CONFIG += c++11
+
+SOURCES += main.cpp
+
+resources.files = \
+ ContactPage.qml \
+ ConversationPage.qml \
+ images/Albert_Einstein.png \
+ images/Albert_Einstein@2x.png \
+ images/Albert_Einstein@3x.png \
+ images/Albert_Einstein@4x.png \
+ images/Ernest_Hemingway.png \
+ images/Ernest_Hemingway@2x.png \
+ images/Ernest_Hemingway@3x.png \
+ images/Ernest_Hemingway@4x.png \
+ images/Hans_Gude.png \
+ images/Hans_Gude@2x.png \
+ images/Hans_Gude@3x.png \
+ images/Hans_Gude@4x.png \
+ main.qml
+resources.prefix = chapter3/
+RESOURCES += resources \
+ qtquickcontrols2.conf
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter3
+INSTALLS += target
diff --git a/examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein.png b/examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein.png
new file mode 100644
index 0000000000..7c44b90b8d
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein@2x.png b/examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein@2x.png
new file mode 100644
index 0000000000..6ce9c39b6c
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein@3x.png b/examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein@3x.png
new file mode 100644
index 0000000000..aab6a6a162
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein@3x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein@4x.png b/examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein@4x.png
new file mode 100644
index 0000000000..3611284df4
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/images/Albert_Einstein@4x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway.png b/examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway.png
new file mode 100644
index 0000000000..3ac8992fd9
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway@2x.png b/examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway@2x.png
new file mode 100644
index 0000000000..122d9f1e53
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway@3x.png b/examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway@3x.png
new file mode 100644
index 0000000000..2fe9c2cc1c
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway@3x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway@4x.png b/examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway@4x.png
new file mode 100644
index 0000000000..96fb6788b5
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/images/Ernest_Hemingway@4x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude.png b/examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude.png
new file mode 100644
index 0000000000..907e38bc61
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude@2x.png b/examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude@2x.png
new file mode 100644
index 0000000000..6837796a83
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude@3x.png b/examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude@3x.png
new file mode 100644
index 0000000000..29af422ad3
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude@3x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude@4x.png b/examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude@4x.png
new file mode 100644
index 0000000000..bc35eeaa79
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/images/Hans_Gude@4x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter3/images/images.qrc b/examples/quickcontrols2/chattutorial/chapter3/images/images.qrc
new file mode 100644
index 0000000000..9eda6aa29c
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/images/images.qrc
@@ -0,0 +1,16 @@
+<RCC>
+ <qresource prefix="/">
+ <file>Albert_Einstein.png</file>
+ <file>Albert_Einstein@2x.png</file>
+ <file>Albert_Einstein@3x.png</file>
+ <file>Albert_Einstein@4x.png</file>
+ <file>Ernest_Hemingway.png</file>
+ <file>Ernest_Hemingway@2x.png</file>
+ <file>Ernest_Hemingway@3x.png</file>
+ <file>Ernest_Hemingway@4x.png</file>
+ <file>Hans_Gude.png</file>
+ <file>Hans_Gude@2x.png</file>
+ <file>Hans_Gude@3x.png</file>
+ <file>Hans_Gude@4x.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/quickcontrols2/chattutorial/chapter2-lists/main.cpp b/examples/quickcontrols2/chattutorial/chapter3/main.cpp
index ea20c89012..657318a775 100644
--- a/examples/quickcontrols2/chattutorial/chapter2-lists/main.cpp
+++ b/examples/quickcontrols2/chattutorial/chapter3/main.cpp
@@ -56,7 +56,7 @@ int main(int argc, char *argv[])
QGuiApplication app(argc, argv);
QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ engine.load(QUrl(QStringLiteral("qrc:/chapter3/main.qml")));
return app.exec();
}
diff --git a/examples/quickcontrols2/chattutorial/chapter3-navigation/main.qml b/examples/quickcontrols2/chattutorial/chapter3/main.qml
index 029f45e3c8..029f45e3c8 100644
--- a/examples/quickcontrols2/chattutorial/chapter3-navigation/main.qml
+++ b/examples/quickcontrols2/chattutorial/chapter3/main.qml
diff --git a/examples/quickcontrols2/chattutorial/chapter3/qtquickcontrols2.conf b/examples/quickcontrols2/chattutorial/chapter3/qtquickcontrols2.conf
new file mode 100644
index 0000000000..db9486764e
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter3/qtquickcontrols2.conf
@@ -0,0 +1,2 @@
+[Controls]
+Style=Basic
diff --git a/examples/quickcontrols2/chattutorial/chapter4-models/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter4-models/CMakeLists.txt
deleted file mode 100644
index 6c11375ed5..0000000000
--- a/examples/quickcontrols2/chattutorial/chapter4-models/CMakeLists.txt
+++ /dev/null
@@ -1,83 +0,0 @@
-# Generated from chapter4-models.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(chapter4-models 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}/quickcontrols2/chattutorial/chapter4-models")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Sql)
-
-qt_add_executable(chapter4-models
- main.cpp
- sqlcontactmodel.cpp sqlcontactmodel.h
- sqlconversationmodel.cpp sqlconversationmodel.h
-)
-set_target_properties(chapter4-models PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(chapter4-models PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
- Qt::Sql
-)
-
-
-# Resources:
-set(qml_resource_files
- "ContactPage.qml"
- "ConversationPage.qml"
- "main.qml"
-)
-
-qt6_add_resources(chapter4-models "qml"
- PREFIX
- "/"
- FILES
- ${qml_resource_files}
-)
-set(shared_resource_files
- "../shared/Albert_Einstein.png"
- "../shared/Albert_Einstein@2x.png"
- "../shared/Albert_Einstein@3x.png"
- "../shared/Albert_Einstein@4x.png"
- "../shared/Ernest_Hemingway.png"
- "../shared/Ernest_Hemingway@2x.png"
- "../shared/Ernest_Hemingway@3x.png"
- "../shared/Ernest_Hemingway@4x.png"
- "../shared/Hans_Gude.png"
- "../shared/Hans_Gude@2x.png"
- "../shared/Hans_Gude@3x.png"
- "../shared/Hans_Gude@4x.png"
-)
-
-qt6_add_resources(chapter4-models "shared"
- PREFIX
- "/"
- BASE
- "../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS chapter4-models
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/quickcontrols2/chattutorial/chapter4-models/chapter4-models.pro b/examples/quickcontrols2/chattutorial/chapter4-models/chapter4-models.pro
deleted file mode 100644
index 2a2d955b1a..0000000000
--- a/examples/quickcontrols2/chattutorial/chapter4-models/chapter4-models.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-TEMPLATE = app
-
-QT += qml quick sql
-CONFIG += c++11
-
-HEADERS += sqlcontactmodel.h \
- sqlconversationmodel.h
-
-SOURCES += main.cpp \
- sqlcontactmodel.cpp \
- sqlconversationmodel.cpp
-
-RESOURCES += \
- qml.qrc \
- ../shared/shared.qrc
-
-target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter4-models
-INSTALLS += target
diff --git a/examples/quickcontrols2/chattutorial/chapter4-models/qml.qrc b/examples/quickcontrols2/chattutorial/chapter4-models/qml.qrc
deleted file mode 100644
index a72e1b7134..0000000000
--- a/examples/quickcontrols2/chattutorial/chapter4-models/qml.qrc
+++ /dev/null
@@ -1,7 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- <file>ContactPage.qml</file>
- <file>ConversationPage.qml</file>
- </qresource>
-</RCC>
diff --git a/examples/quickcontrols2/chattutorial/chapter4/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter4/CMakeLists.txt
new file mode 100644
index 0000000000..aba8c1000b
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/CMakeLists.txt
@@ -0,0 +1,63 @@
+cmake_minimum_required(VERSION 3.16)
+project(chapter4 LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter4")
+
+find_package(Qt6 COMPONENTS Core Gui Qml Quick Sql)
+
+qt_add_executable(chattutorial-chapter4 WIN32 MACOSX_BUNDLE
+ main.cpp
+ sqlcontactmodel.cpp sqlcontactmodel.h
+ sqlconversationmodel.cpp sqlconversationmodel.h
+)
+target_link_libraries(chattutorial-chapter4 PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+ Qt::Sql
+)
+
+# Resources:
+qt_add_qml_module(chattutorial-chapter4
+ URI chapter4
+ VERSION 1.0
+ QML_FILES
+ "ContactPage.qml"
+ "ConversationPage.qml"
+ "main.qml"
+ RESOURCES
+ "images/Albert_Einstein.png"
+ "images/Albert_Einstein@2x.png"
+ "images/Albert_Einstein@3x.png"
+ "images/Albert_Einstein@4x.png"
+ "images/Ernest_Hemingway.png"
+ "images/Ernest_Hemingway@2x.png"
+ "images/Ernest_Hemingway@3x.png"
+ "images/Ernest_Hemingway@4x.png"
+ "images/Hans_Gude.png"
+ "images/Hans_Gude@2x.png"
+ "images/Hans_Gude@3x.png"
+ "images/Hans_Gude@4x.png"
+)
+
+qt6_add_resources(chattutorial-chapter4 "conf"
+ PREFIX
+ "/"
+ FILES
+ "qtquickcontrols2.conf"
+)
+
+install(TARGETS chattutorial-chapter4
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/quickcontrols2/chattutorial/chapter4-models/ContactPage.qml b/examples/quickcontrols2/chattutorial/chapter4/ContactPage.qml
index c8e8872420..e0fc2e12c9 100644
--- a/examples/quickcontrols2/chattutorial/chapter4-models/ContactPage.qml
+++ b/examples/quickcontrols2/chattutorial/chapter4/ContactPage.qml
@@ -78,11 +78,11 @@ Page {
width: listView.width - listView.leftMargin - listView.rightMargin
height: avatar.implicitHeight
leftPadding: avatar.implicitWidth + 32
- onClicked: root.StackView.view.push("qrc:/ConversationPage.qml", { inConversationWith: model.display })
+ onClicked: root.StackView.view.push("ConversationPage.qml", { inConversationWith: model.display })
Image {
id: avatar
- source: "qrc:/" + model.display.replace(" ", "_") + ".png"
+ source: "images/" + model.display.replace(" ", "_") + ".png"
}
}
}
diff --git a/examples/quickcontrols2/chattutorial/chapter4-models/ConversationPage.qml b/examples/quickcontrols2/chattutorial/chapter4/ConversationPage.qml
index 35f770f58b..f69ebcd467 100644
--- a/examples/quickcontrols2/chattutorial/chapter4-models/ConversationPage.qml
+++ b/examples/quickcontrols2/chattutorial/chapter4/ConversationPage.qml
@@ -104,7 +104,7 @@ Page {
Image {
id: avatar
- source: !sentByMe ? "qrc:/" + model.author.replace(" ", "_") + ".png" : ""
+ source: !sentByMe ? "images/" + model.author.replace(" ", "_") + ".png" : ""
}
Rectangle {
diff --git a/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro b/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro
new file mode 100644
index 0000000000..ae8141f7f1
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/chapter4.pro
@@ -0,0 +1,34 @@
+TEMPLATE = app
+
+QT += qml quick sql
+CONFIG += c++11
+
+HEADERS += sqlcontactmodel.h \
+ sqlconversationmodel.h
+
+SOURCES += main.cpp \
+ sqlcontactmodel.cpp \
+ sqlconversationmodel.cpp
+
+resources.files = \
+ ContactPage.qml \
+ ConversationPage.qml \
+ images/Albert_Einstein.png \
+ images/Albert_Einstein@2x.png \
+ images/Albert_Einstein@3x.png \
+ images/Albert_Einstein@4x.png \
+ images/Ernest_Hemingway.png \
+ images/Ernest_Hemingway@2x.png \
+ images/Ernest_Hemingway@3x.png \
+ images/Ernest_Hemingway@4x.png \
+ images/Hans_Gude.png \
+ images/Hans_Gude@2x.png \
+ images/Hans_Gude@3x.png \
+ images/Hans_Gude@4x.png \
+ main.qml
+resources.prefix = chapter4/
+RESOURCES += resources \
+ qtquickcontrols2.conf
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter4
+INSTALLS += target
diff --git a/examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein.png b/examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein.png
new file mode 100644
index 0000000000..7c44b90b8d
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein@2x.png b/examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein@2x.png
new file mode 100644
index 0000000000..6ce9c39b6c
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein@3x.png b/examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein@3x.png
new file mode 100644
index 0000000000..aab6a6a162
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein@3x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein@4x.png b/examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein@4x.png
new file mode 100644
index 0000000000..3611284df4
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/images/Albert_Einstein@4x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway.png b/examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway.png
new file mode 100644
index 0000000000..3ac8992fd9
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway@2x.png b/examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway@2x.png
new file mode 100644
index 0000000000..122d9f1e53
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway@3x.png b/examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway@3x.png
new file mode 100644
index 0000000000..2fe9c2cc1c
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway@3x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway@4x.png b/examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway@4x.png
new file mode 100644
index 0000000000..96fb6788b5
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/images/Ernest_Hemingway@4x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude.png b/examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude.png
new file mode 100644
index 0000000000..907e38bc61
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude@2x.png b/examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude@2x.png
new file mode 100644
index 0000000000..6837796a83
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude@3x.png b/examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude@3x.png
new file mode 100644
index 0000000000..29af422ad3
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude@3x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude@4x.png b/examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude@4x.png
new file mode 100644
index 0000000000..bc35eeaa79
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/images/Hans_Gude@4x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter4/images/images.qrc b/examples/quickcontrols2/chattutorial/chapter4/images/images.qrc
new file mode 100644
index 0000000000..9eda6aa29c
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/images/images.qrc
@@ -0,0 +1,16 @@
+<RCC>
+ <qresource prefix="/">
+ <file>Albert_Einstein.png</file>
+ <file>Albert_Einstein@2x.png</file>
+ <file>Albert_Einstein@3x.png</file>
+ <file>Albert_Einstein@4x.png</file>
+ <file>Ernest_Hemingway.png</file>
+ <file>Ernest_Hemingway@2x.png</file>
+ <file>Ernest_Hemingway@3x.png</file>
+ <file>Ernest_Hemingway@4x.png</file>
+ <file>Hans_Gude.png</file>
+ <file>Hans_Gude@2x.png</file>
+ <file>Hans_Gude@3x.png</file>
+ <file>Hans_Gude@4x.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/quickcontrols2/chattutorial/chapter4-models/main.cpp b/examples/quickcontrols2/chattutorial/chapter4/main.cpp
index bbe7b3ad66..e4a06399e8 100644
--- a/examples/quickcontrols2/chattutorial/chapter4-models/main.cpp
+++ b/examples/quickcontrols2/chattutorial/chapter4/main.cpp
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
connectToDatabase();
QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ engine.load(QUrl(QStringLiteral("qrc:/chapter4/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
diff --git a/examples/quickcontrols2/chattutorial/chapter4-models/main.qml b/examples/quickcontrols2/chattutorial/chapter4/main.qml
index 029f45e3c8..029f45e3c8 100644
--- a/examples/quickcontrols2/chattutorial/chapter4-models/main.qml
+++ b/examples/quickcontrols2/chattutorial/chapter4/main.qml
diff --git a/examples/quickcontrols2/chattutorial/chapter4/qtquickcontrols2.conf b/examples/quickcontrols2/chattutorial/chapter4/qtquickcontrols2.conf
new file mode 100644
index 0000000000..db9486764e
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter4/qtquickcontrols2.conf
@@ -0,0 +1,2 @@
+[Controls]
+Style=Basic
diff --git a/examples/quickcontrols2/chattutorial/chapter4-models/sqlcontactmodel.cpp b/examples/quickcontrols2/chattutorial/chapter4/sqlcontactmodel.cpp
index 6203ebec1e..6203ebec1e 100644
--- a/examples/quickcontrols2/chattutorial/chapter4-models/sqlcontactmodel.cpp
+++ b/examples/quickcontrols2/chattutorial/chapter4/sqlcontactmodel.cpp
diff --git a/examples/quickcontrols2/chattutorial/chapter4-models/sqlcontactmodel.h b/examples/quickcontrols2/chattutorial/chapter4/sqlcontactmodel.h
index fdbe5f1e70..5953c76258 100644
--- a/examples/quickcontrols2/chattutorial/chapter4-models/sqlcontactmodel.h
+++ b/examples/quickcontrols2/chattutorial/chapter4/sqlcontactmodel.h
@@ -56,7 +56,7 @@
class SqlContactModel : public QSqlQueryModel
{
public:
- SqlContactModel(QObject *parent = 0);
+ SqlContactModel(QObject *parent = nullptr);
};
#endif // SQLCONTACTMODEL_H
diff --git a/examples/quickcontrols2/chattutorial/chapter4-models/sqlconversationmodel.cpp b/examples/quickcontrols2/chattutorial/chapter4/sqlconversationmodel.cpp
index 99526e81d3..99526e81d3 100644
--- a/examples/quickcontrols2/chattutorial/chapter4-models/sqlconversationmodel.cpp
+++ b/examples/quickcontrols2/chattutorial/chapter4/sqlconversationmodel.cpp
diff --git a/examples/quickcontrols2/chattutorial/chapter4-models/sqlconversationmodel.h b/examples/quickcontrols2/chattutorial/chapter4/sqlconversationmodel.h
index 14ab12e262..9c65d64a84 100644
--- a/examples/quickcontrols2/chattutorial/chapter4-models/sqlconversationmodel.h
+++ b/examples/quickcontrols2/chattutorial/chapter4/sqlconversationmodel.h
@@ -59,7 +59,7 @@ class SqlConversationModel : public QSqlTableModel
Q_PROPERTY(QString recipient READ recipient WRITE setRecipient NOTIFY recipientChanged)
public:
- SqlConversationModel(QObject *parent = 0);
+ SqlConversationModel(QObject *parent = nullptr);
QString recipient() const;
void setRecipient(const QString &recipient);
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter5-styling/CMakeLists.txt
deleted file mode 100644
index 80a9bde0e1..0000000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/CMakeLists.txt
+++ /dev/null
@@ -1,86 +0,0 @@
-# Generated from chapter5-styling.pro.
-
-cmake_minimum_required(VERSION 3.16)
-project(chapter5-styling 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}/quickcontrols2/chattutorial/chapter5-styling")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Qml)
-find_package(Qt6 COMPONENTS Quick)
-find_package(Qt6 COMPONENTS Sql)
-
-qt_add_executable(chapter5-styling
- main.cpp
- sqlcontactmodel.cpp sqlcontactmodel.h
- sqlconversationmodel.cpp sqlconversationmodel.h
-)
-set_target_properties(chapter5-styling PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(chapter5-styling PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Qml
- Qt::Quick
- Qt::Sql
-)
-
-
-# Resources:
-set(qml_resource_files
- "+Material/ChatToolBar.qml"
- "ChatToolBar.qml"
- "ContactPage.qml"
- "ConversationPage.qml"
- "main.qml"
- "qtquickcontrols2.conf"
-)
-
-qt6_add_resources(chapter5-styling "qml"
- PREFIX
- "/"
- FILES
- ${qml_resource_files}
-)
-set(shared_resource_files
- "../shared/Albert_Einstein.png"
- "../shared/Albert_Einstein@2x.png"
- "../shared/Albert_Einstein@3x.png"
- "../shared/Albert_Einstein@4x.png"
- "../shared/Ernest_Hemingway.png"
- "../shared/Ernest_Hemingway@2x.png"
- "../shared/Ernest_Hemingway@3x.png"
- "../shared/Ernest_Hemingway@4x.png"
- "../shared/Hans_Gude.png"
- "../shared/Hans_Gude@2x.png"
- "../shared/Hans_Gude@3x.png"
- "../shared/Hans_Gude@4x.png"
-)
-
-qt6_add_resources(chapter5-styling "shared"
- PREFIX
- "/"
- BASE
- "../shared"
- FILES
- ${shared_resource_files}
-)
-
-install(TARGETS chapter5-styling
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/chapter5-styling.pro b/examples/quickcontrols2/chattutorial/chapter5-styling/chapter5-styling.pro
deleted file mode 100644
index e798fe3cd7..0000000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/chapter5-styling.pro
+++ /dev/null
@@ -1,18 +0,0 @@
-TEMPLATE = app
-
-QT += qml quick sql
-CONFIG += c++11
-
-HEADERS += sqlcontactmodel.h \
- sqlconversationmodel.h
-
-SOURCES += main.cpp \
- sqlcontactmodel.cpp \
- sqlconversationmodel.cpp
-
-RESOURCES += \
- qml.qrc \
- ../shared/shared.qrc
-
-target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter5-styling
-INSTALLS += target
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/qml.qrc b/examples/quickcontrols2/chattutorial/chapter5-styling/qml.qrc
deleted file mode 100644
index 54cf6d5a99..0000000000
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/qml.qrc
+++ /dev/null
@@ -1,10 +0,0 @@
-<RCC>
- <qresource prefix="/">
- <file>main.qml</file>
- <file>ContactPage.qml</file>
- <file>ConversationPage.qml</file>
- <file>qtquickcontrols2.conf</file>
- <file>ChatToolBar.qml</file>
- <file>+Material/ChatToolBar.qml</file>
- </qresource>
-</RCC>
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/+Material/ChatToolBar.qml b/examples/quickcontrols2/chattutorial/chapter5/+Material/ChatToolBar.qml
index d4a66764bd..d4a66764bd 100644
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/+Material/ChatToolBar.qml
+++ b/examples/quickcontrols2/chattutorial/chapter5/+Material/ChatToolBar.qml
diff --git a/examples/quickcontrols2/chattutorial/chapter5/CMakeLists.txt b/examples/quickcontrols2/chattutorial/chapter5/CMakeLists.txt
new file mode 100644
index 0000000000..1d39757f1d
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/CMakeLists.txt
@@ -0,0 +1,65 @@
+cmake_minimum_required(VERSION 3.16)
+project(chapter5 LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/chattutorial/chapter5")
+
+find_package(Qt6 COMPONENTS Core Gui Qml Quick Sql)
+
+qt_add_executable(chattutorial-chapter5 WIN32 MACOSX_BUNDLE
+ main.cpp
+ sqlcontactmodel.cpp sqlcontactmodel.h
+ sqlconversationmodel.cpp sqlconversationmodel.h
+)
+target_link_libraries(chattutorial-chapter5 PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+ Qt::Sql
+)
+
+# Resources:
+qt_add_qml_module(chattutorial-chapter5
+ URI chapter5
+ VERSION 1.0
+ QML_FILES
+ "+Material/ChatToolBar.qml"
+ "ChatToolBar.qml"
+ "ContactPage.qml"
+ "ConversationPage.qml"
+ "main.qml"
+ RESOURCES
+ "images/Albert_Einstein.png"
+ "images/Albert_Einstein@2x.png"
+ "images/Albert_Einstein@3x.png"
+ "images/Albert_Einstein@4x.png"
+ "images/Ernest_Hemingway.png"
+ "images/Ernest_Hemingway@2x.png"
+ "images/Ernest_Hemingway@3x.png"
+ "images/Ernest_Hemingway@4x.png"
+ "images/Hans_Gude.png"
+ "images/Hans_Gude@2x.png"
+ "images/Hans_Gude@3x.png"
+ "images/Hans_Gude@4x.png"
+)
+
+qt6_add_resources(chattutorial-chapter5 "conf"
+ PREFIX
+ "/"
+ FILES
+ "qtquickcontrols2.conf"
+)
+
+install(TARGETS chattutorial-chapter5
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/ChatToolBar.qml b/examples/quickcontrols2/chattutorial/chapter5/ChatToolBar.qml
index c192aeb51a..c192aeb51a 100644
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/ChatToolBar.qml
+++ b/examples/quickcontrols2/chattutorial/chapter5/ChatToolBar.qml
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/ContactPage.qml b/examples/quickcontrols2/chattutorial/chapter5/ContactPage.qml
index 65460bf127..34a138edca 100644
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/ContactPage.qml
+++ b/examples/quickcontrols2/chattutorial/chapter5/ContactPage.qml
@@ -78,11 +78,11 @@ Page {
width: listView.width - listView.leftMargin - listView.rightMargin
height: avatar.implicitHeight
leftPadding: avatar.implicitWidth + 32
- onClicked: root.StackView.view.push("qrc:/ConversationPage.qml", { inConversationWith: model.display })
+ onClicked: root.StackView.view.push("ConversationPage.qml", { inConversationWith: model.display })
Image {
id: avatar
- source: "qrc:/" + model.display.replace(" ", "_") + ".png"
+ source: "images/" + model.display.replace(" ", "_") + ".png"
}
}
}
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/ConversationPage.qml b/examples/quickcontrols2/chattutorial/chapter5/ConversationPage.qml
index c668072e34..60dbc4a2ee 100644
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/ConversationPage.qml
+++ b/examples/quickcontrols2/chattutorial/chapter5/ConversationPage.qml
@@ -104,7 +104,7 @@ Page {
Image {
id: avatar
- source: !sentByMe ? "qrc:/" + model.author.replace(" ", "_") + ".png" : ""
+ source: !sentByMe ? "images/" + model.author.replace(" ", "_") + ".png" : ""
}
Rectangle {
diff --git a/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro b/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro
new file mode 100644
index 0000000000..625642d7b5
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/chapter5.pro
@@ -0,0 +1,36 @@
+TEMPLATE = app
+
+QT += qml quick sql
+CONFIG += c++11
+
+HEADERS += sqlcontactmodel.h \
+ sqlconversationmodel.h
+
+SOURCES += main.cpp \
+ sqlcontactmodel.cpp \
+ sqlconversationmodel.cpp
+
+resources.files = \
+ +Material/ChatToolBar.qml \
+ ChatToolBar.qml \
+ ContactPage.qml \
+ ConversationPage.qml \
+ images/Albert_Einstein.png \
+ images/Albert_Einstein@2x.png \
+ images/Albert_Einstein@3x.png \
+ images/Albert_Einstein@4x.png \
+ images/Ernest_Hemingway.png \
+ images/Ernest_Hemingway@2x.png \
+ images/Ernest_Hemingway@3x.png \
+ images/Ernest_Hemingway@4x.png \
+ images/Hans_Gude.png \
+ images/Hans_Gude@2x.png \
+ images/Hans_Gude@3x.png \
+ images/Hans_Gude@4x.png \
+ main.qml
+resources.prefix = chapter5/
+RESOURCES += resources \
+ qtquickcontrols2.conf
+
+target.path = $$[QT_INSTALL_EXAMPLES]/quickcontrols2/chattutorial/chapter5
+INSTALLS += target
diff --git a/examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein.png b/examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein.png
new file mode 100644
index 0000000000..7c44b90b8d
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein@2x.png b/examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein@2x.png
new file mode 100644
index 0000000000..6ce9c39b6c
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein@3x.png b/examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein@3x.png
new file mode 100644
index 0000000000..aab6a6a162
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein@3x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein@4x.png b/examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein@4x.png
new file mode 100644
index 0000000000..3611284df4
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/images/Albert_Einstein@4x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway.png b/examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway.png
new file mode 100644
index 0000000000..3ac8992fd9
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway@2x.png b/examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway@2x.png
new file mode 100644
index 0000000000..122d9f1e53
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway@3x.png b/examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway@3x.png
new file mode 100644
index 0000000000..2fe9c2cc1c
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway@3x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway@4x.png b/examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway@4x.png
new file mode 100644
index 0000000000..96fb6788b5
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/images/Ernest_Hemingway@4x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude.png b/examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude.png
new file mode 100644
index 0000000000..907e38bc61
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude@2x.png b/examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude@2x.png
new file mode 100644
index 0000000000..6837796a83
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude@2x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude@3x.png b/examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude@3x.png
new file mode 100644
index 0000000000..29af422ad3
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude@3x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude@4x.png b/examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude@4x.png
new file mode 100644
index 0000000000..bc35eeaa79
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/images/Hans_Gude@4x.png
Binary files differ
diff --git a/examples/quickcontrols2/chattutorial/chapter5/images/images.qrc b/examples/quickcontrols2/chattutorial/chapter5/images/images.qrc
new file mode 100644
index 0000000000..9eda6aa29c
--- /dev/null
+++ b/examples/quickcontrols2/chattutorial/chapter5/images/images.qrc
@@ -0,0 +1,16 @@
+<RCC>
+ <qresource prefix="/">
+ <file>Albert_Einstein.png</file>
+ <file>Albert_Einstein@2x.png</file>
+ <file>Albert_Einstein@3x.png</file>
+ <file>Albert_Einstein@4x.png</file>
+ <file>Ernest_Hemingway.png</file>
+ <file>Ernest_Hemingway@2x.png</file>
+ <file>Ernest_Hemingway@3x.png</file>
+ <file>Ernest_Hemingway@4x.png</file>
+ <file>Hans_Gude.png</file>
+ <file>Hans_Gude@2x.png</file>
+ <file>Hans_Gude@3x.png</file>
+ <file>Hans_Gude@4x.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/main.cpp b/examples/quickcontrols2/chattutorial/chapter5/main.cpp
index bbe7b3ad66..74e66106d4 100644
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/main.cpp
+++ b/examples/quickcontrols2/chattutorial/chapter5/main.cpp
@@ -90,7 +90,7 @@ int main(int argc, char *argv[])
connectToDatabase();
QQmlApplicationEngine engine;
- engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ engine.load(QUrl(QStringLiteral("qrc:/chapter5/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/main.qml b/examples/quickcontrols2/chattutorial/chapter5/main.qml
index 029f45e3c8..029f45e3c8 100644
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/main.qml
+++ b/examples/quickcontrols2/chattutorial/chapter5/main.qml
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/qtquickcontrols2.conf b/examples/quickcontrols2/chattutorial/chapter5/qtquickcontrols2.conf
index e338c80432..c8a8eeeb05 100644
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/qtquickcontrols2.conf
+++ b/examples/quickcontrols2/chattutorial/chapter5/qtquickcontrols2.conf
@@ -1,4 +1,7 @@
-[material]
+[Controls]
+Style=Basic
+
+[Material]
Primary=Indigo
Accent=Indigo
Theme=Dark
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlcontactmodel.cpp b/examples/quickcontrols2/chattutorial/chapter5/sqlcontactmodel.cpp
index 6203ebec1e..6203ebec1e 100644
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlcontactmodel.cpp
+++ b/examples/quickcontrols2/chattutorial/chapter5/sqlcontactmodel.cpp
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlcontactmodel.h b/examples/quickcontrols2/chattutorial/chapter5/sqlcontactmodel.h
index fdbe5f1e70..5953c76258 100644
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlcontactmodel.h
+++ b/examples/quickcontrols2/chattutorial/chapter5/sqlcontactmodel.h
@@ -56,7 +56,7 @@
class SqlContactModel : public QSqlQueryModel
{
public:
- SqlContactModel(QObject *parent = 0);
+ SqlContactModel(QObject *parent = nullptr);
};
#endif // SQLCONTACTMODEL_H
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlconversationmodel.cpp b/examples/quickcontrols2/chattutorial/chapter5/sqlconversationmodel.cpp
index 99526e81d3..99526e81d3 100644
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlconversationmodel.cpp
+++ b/examples/quickcontrols2/chattutorial/chapter5/sqlconversationmodel.cpp
diff --git a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlconversationmodel.h b/examples/quickcontrols2/chattutorial/chapter5/sqlconversationmodel.h
index 14ab12e262..9c65d64a84 100644
--- a/examples/quickcontrols2/chattutorial/chapter5-styling/sqlconversationmodel.h
+++ b/examples/quickcontrols2/chattutorial/chapter5/sqlconversationmodel.h
@@ -59,7 +59,7 @@ class SqlConversationModel : public QSqlTableModel
Q_PROPERTY(QString recipient READ recipient WRITE setRecipient NOTIFY recipientChanged)
public:
- SqlConversationModel(QObject *parent = 0);
+ SqlConversationModel(QObject *parent = nullptr);
QString recipient() const;
void setRecipient(const QString &recipient);
diff --git a/examples/quickcontrols2/chattutorial/chattutorial.pro b/examples/quickcontrols2/chattutorial/chattutorial.pro
index 2f38254ed8..1c70b2653e 100644
--- a/examples/quickcontrols2/chattutorial/chattutorial.pro
+++ b/examples/quickcontrols2/chattutorial/chattutorial.pro
@@ -1,8 +1,8 @@
TEMPLATE = subdirs
SUBDIRS += \
- chapter1-settingup \
- chapter2-lists \
- chapter3-navigation \
- chapter4-models \
- chapter5-styling
+ chapter1 \
+ chapter2 \
+ chapter3 \
+ chapter4 \
+ chapter5
diff --git a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc
index a56a470379..e457a414b1 100644
--- a/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc
+++ b/examples/quickcontrols2/chattutorial/doc/src/qtquickcontrols2-chattutorial.qdoc
@@ -52,14 +52,14 @@ basic "Hello World" application with the following files:
\li \c chattutorial.pro - Provides the qmake configuration
\endlist
-\note Delete the \c MainForm.ui.qml from the project as we will
-not use it in this tutorial.
+\note Delete the \c MainForm.ui.qml and \c qml.qrc files from the project, as
+we will not use them in this tutorial.
\section2 main.cpp
The default code in \c main.cpp has two includes:
-\quotefromfile chattutorial/chapter1-settingup/main.cpp
+\quotefromfile chattutorial/chapter1/main.cpp
\skipto include
\printline include
\printline include
@@ -96,7 +96,7 @@ Once we've set up things in C++, we can move on to the user interface in QML.
Let's modify the default QML code to suit our needs.
-\quotefromfile chattutorial/chapter1-settingup/main.qml
+\quotefromfile chattutorial/chapter1/main.qml
\skipto import
\printuntil import QtQuick.Controls
@@ -145,7 +145,7 @@ which screen the user is viewing, it is much easier to use \l Page.
For now, we'll just add one page, but in the next chapter, we'll demonstrate
how to navigate between several pages.
-\quotefromfile chattutorial/chapter1-settingup/main.qml
+\quotefromfile chattutorial/chapter1/main.qml
\skipto Page
\printuntil }
\printuntil }
@@ -183,7 +183,7 @@ The \c .pro or \l {Creating Project Files}{project} file contains all of the
information needed by \l {qmake Manual}{qmake} to generate a Makefile, which is
then used to compile and link the application.
-\quotefromfile chattutorial/chapter1-settingup/chapter1-settingup.pro
+\quotefromfile chattutorial/chapter1/chapter1.pro
\printline TEMPLATE
The first line tells \c qmake which kind of project this is. We're building an
@@ -203,7 +203,7 @@ project.
The \c SOURCES variable lists all of the source files that should be compiled.
A similar variable, \c HEADERS, is available for header files.
-\printline RESOURCES
+\printuntil qtquickcontrols2
The next line tells \c qmake that we have a collection of
\l {The Qt Resource System}{resources} that should be built into the
@@ -234,7 +234,7 @@ can display text, be checked on and off, and react to mouse clicks.
Here is our ListView:
-\quotefromfile chattutorial/chapter2-lists/main.qml
+\quotefromfile chattutorial/chapter2/main.qml
\dots 8
\codeline
\skipto ListView
@@ -303,7 +303,7 @@ vertical space.
In this chapter, you'll learn how to use \l StackView to navigate between pages
in an application. Here's the revised \c main.qml:
-\quotefromfile chattutorial/chapter3-navigation/main.qml
+\quotefromfile chattutorial/chapter3/main.qml
\skipto import
\printuntil }
\printuntil }
@@ -362,7 +362,7 @@ application-wide and context-sensitive actions and controls, such as navigation
buttons and search fields. Best of all, it has a background color that, as
usual, comes from the application style. Here it is in action:
-\quotefromfile chattutorial/chapter3-navigation/ContactPage.qml
+\quotefromfile chattutorial/chapter3/ContactPage.qml
\skipto header
\printuntil }
\printuntil }
@@ -389,7 +389,7 @@ name, which it then uses to display the relevant conversation. Note the
Let's step through \c ConversationPage.qml, beginning with the imports:
-\quotefromfile chattutorial/chapter3-navigation/ConversationPage.qml
+\quotefromfile chattutorial/chapter3/ConversationPage.qml
\skipto import
\printline import
\printline import
@@ -459,7 +459,7 @@ accommodating the Pane.
Let's look at the listview in detail:
-\quotefromfile chattutorial/chapter3-navigation/ConversationPage.qml
+\quotefromfile chattutorial/chapter3/ConversationPage.qml
\skipto ListView
\printuntil ScrollBar
\printuntil }
@@ -539,13 +539,13 @@ purpose, as it provides a read-only data model for SQL result sets.
Let's take a look at our \c SqlContactModel class that derives from
QSqlQueryModel:
-\quotefromfile chattutorial/chapter4-models/sqlcontactmodel.h
+\quotefromfile chattutorial/chapter4/sqlcontactmodel.h
\skipto #include
\printuntil };
There's not much going on here, so let's move on to the \c .cpp file:
-\quotefromfile chattutorial/chapter4-models/sqlcontactmodel.cpp
+\quotefromfile chattutorial/chapter4/sqlcontactmodel.cpp
\skipto #include
\printuntil }
\printuntil }
@@ -572,7 +572,7 @@ all rows of the \c Contacts table.
\c SqlConversationModel is more complex:
-\quotefromfile chattutorial/chapter4-models/sqlconversationmodel.h
+\quotefromfile chattutorial/chapter4/sqlconversationmodel.h
\skipto #include
\printuntil };
@@ -592,7 +592,7 @@ QML, hence the \c Q_INVOKABLE macro.
Let's take a look at the \c .cpp file:
-\quotefromfile chattutorial/chapter4-models/sqlconversationmodel.cpp
+\quotefromfile chattutorial/chapter4/sqlconversationmodel.cpp
\skipto #include
\printuntil }
\printuntil }
@@ -649,7 +649,7 @@ of \l QSqlTableModel::OnManualSubmit, we must manually call
Now that we've established the model classes, let's take a look at \c main.cpp:
-\quotefromfile chattutorial/chapter4-models/main.cpp
+\quotefromfile chattutorial/chapter4/main.cpp
\skipto #include
\printuntil return app.exec();
\printuntil }
@@ -666,7 +666,7 @@ Now that we have the models available as QML types, there are some minor
changes to be done to \c ContactPage.qml. To be able to use the types,
we must first import them using the URI we set in \c main.cpp:
-\quotefromfile chattutorial/chapter4-models/ContactPage.qml
+\quotefromfile chattutorial/chapter4/ContactPage.qml
\skipto import io.qt.examples.chattutorial
\printline import io.qt.examples.chattutorial
@@ -683,7 +683,7 @@ Within the delegate, we use a different syntax for accessing the model data:
In \c ConversationPage.qml, we add the same \c chattutorial import, and replace
the dummy model:
-\quotefromfile chattutorial/chapter4-models/ConversationPage.qml
+\quotefromfile chattutorial/chapter4/ConversationPage.qml
\skipto model: SqlConversationModel {
\printuntil }
@@ -792,7 +792,7 @@ means that it will be used when the \l {Basic Style}{Basic style} (which is the
style that is used when none is specified) is in
use. Here's the new file:
-\quotefromfile chattutorial/chapter5-styling/ChatToolBar.qml
+\quotefromfile chattutorial/chapter5/ChatToolBar.qml
\skipto import
\printuntil }
@@ -803,7 +803,7 @@ of the file, nothing needs to be different.
Back in \c ContactPage.qml, we update the code to use the new type:
-\quotefromfile chattutorial/chapter5-styling/ContactPage.qml
+\quotefromfile chattutorial/chapter5/ContactPage.qml
\skipto ToolBar
\printuntil }
\printuntil }
@@ -817,13 +817,13 @@ that the selection feature is not accidentally triggered.
Here's \c +Material/ChatToolBar.qml:
-\quotefromfile chattutorial/chapter5-styling/+Material/ChatToolBar.qml
+\quotefromfile chattutorial/chapter5/+Material/ChatToolBar.qml
\skipto import
\printuntil }
We'll make the same changes to \c ConversationPage.qml:
-\quotefromfile chattutorial/chapter5-styling/ConversationPage.qml
+\quotefromfile chattutorial/chapter5/ConversationPage.qml
\skipto header: ChatToolBar
\printuntil }
\printuntil }
diff --git a/examples/quickcontrols2/flatstyle/flatstyle.qmlproject b/examples/quickcontrols2/flatstyle/flatstyle.qmlproject
new file mode 100644
index 0000000000..80b42820ad
--- /dev/null
+++ b/examples/quickcontrols2/flatstyle/flatstyle.qmlproject
@@ -0,0 +1,45 @@
+import QmlProject
+
+Project {
+ mainFile: "flatstyle.qml"
+
+ /* Include .qml, .js, and image files from current directory and subdirectories */
+ QmlFiles {
+ directory: "."
+ }
+
+ JavaScriptFiles {
+ directory: "."
+ }
+
+ ImageFiles {
+ directory: "."
+ }
+
+ Files {
+ filter: "*.conf"
+ files: ["qtquickcontrols2.conf"]
+ }
+
+ Files {
+ filter: "qmldir"
+ directory: "."
+ }
+
+ Files {
+ filter: "*.ttf;*.otf"
+ }
+
+ Environment {
+ QT_QUICK_CONTROLS_CONF: "qtquickcontrols2.conf"
+ QT_AUTO_SCREEN_SCALE_FACTOR: "1"
+ }
+
+ qt6Project: true
+
+ /* List of plugin directories passed to QML runtime */
+ importPaths: [ ".", "imports" ]
+
+ /* Required for deployment */
+ targetDirectory: "/opt/flatstyle"
+}
diff --git a/examples/quickcontrols2/texteditor/CMakeLists.txt b/examples/quickcontrols2/texteditor/CMakeLists.txt
index 187d1a88b4..6c3de0891f 100644
--- a/examples/quickcontrols2/texteditor/CMakeLists.txt
+++ b/examples/quickcontrols2/texteditor/CMakeLists.txt
@@ -37,7 +37,6 @@ set(texteditor_resource_files
"images/qt-logo.png"
"qml/+touch/texteditor.qml"
"qml/texteditor.qml"
- "qtquickcontrols2.conf"
"texteditor.html"
)
diff --git a/examples/quickcontrols2/texteditor/documenthandler.cpp b/examples/quickcontrols2/texteditor/documenthandler.cpp
index d904e6f637..b266bc5694 100644
--- a/examples/quickcontrols2/texteditor/documenthandler.cpp
+++ b/examples/quickcontrols2/texteditor/documenthandler.cpp
@@ -323,4 +323,73 @@ void DocumentHandler::setFont(const QFont & font){
emit fontChanged();
}
+bool DocumentHandler::bold() const
+{
+ const QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return m_document->textDocument()->defaultFont().bold();
+ return cursor.charFormat().font().bold();
+}
+
+void DocumentHandler::setBold(bool bold)
+{
+ const QTextCursor cursor = textCursor();
+ if (!cursor.isNull() && cursor.charFormat().font().bold() == bold)
+ return;
+
+ QFont font = cursor.charFormat().font();
+ font.setBold(bold);
+ QTextCharFormat format;
+ format.setFont(font);
+ mergeFormatOnWordOrSelection(format);
+
+ emit boldChanged();
+}
+
+bool DocumentHandler::underline() const
+{
+ const QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return m_document->textDocument()->defaultFont().underline();
+ return cursor.charFormat().font().underline();
+}
+
+void DocumentHandler::setUnderline(bool underline)
+{
+ const QTextCursor cursor = textCursor();
+ if (!cursor.isNull() && cursor.charFormat().font().underline() == underline)
+ return;
+
+ QFont font = cursor.charFormat().font();
+ font.setUnderline(underline);
+ QTextCharFormat format;
+ format.setFont(font);
+ mergeFormatOnWordOrSelection(format);
+
+ emit underlineChanged();
+}
+
+bool DocumentHandler::italic() const
+{
+ const QTextCursor cursor = textCursor();
+ if (cursor.isNull())
+ return m_document->textDocument()->defaultFont().italic();
+ return cursor.charFormat().font().italic();
+}
+
+void DocumentHandler::setItalic(bool italic)
+{
+ const QTextCursor cursor = textCursor();
+ if (!cursor.isNull() && cursor.charFormat().font().italic() == italic)
+ return;
+
+ QFont font = cursor.charFormat().font();
+ font.setItalic(italic);
+ QTextCharFormat format;
+ format.setFont(font);
+ mergeFormatOnWordOrSelection(format);
+
+ emit italicChanged();
+}
+
#include "moc_documenthandler.cpp"
diff --git a/examples/quickcontrols2/texteditor/documenthandler.h b/examples/quickcontrols2/texteditor/documenthandler.h
index 66b5957a20..aa3f257558 100644
--- a/examples/quickcontrols2/texteditor/documenthandler.h
+++ b/examples/quickcontrols2/texteditor/documenthandler.h
@@ -75,6 +75,10 @@ class DocumentHandler : public QObject
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
+ Q_PROPERTY(bool bold READ bold WRITE setBold NOTIFY boldChanged)
+ Q_PROPERTY(bool underline READ underline WRITE setUnderline NOTIFY underlineChanged)
+ Q_PROPERTY(bool italic READ italic WRITE setItalic NOTIFY italicChanged)
+
Q_PROPERTY(QString fileName READ fileName NOTIFY fileUrlChanged)
Q_PROPERTY(QString fileType READ fileType NOTIFY fileUrlChanged)
Q_PROPERTY(QUrl fileUrl READ fileUrl NOTIFY fileUrlChanged)
@@ -105,6 +109,15 @@ public:
QFont font() const;
void setFont(const QFont & font);
+ bool bold() const;
+ void setBold(bool bold);
+
+ bool underline() const;
+ void setUnderline(bool underline);
+
+ bool italic() const;
+ void setItalic(bool italic);
+
QString fileName() const;
QString fileType() const;
QUrl fileUrl() const;
@@ -123,6 +136,9 @@ Q_SIGNALS:
void selectionEndChanged();
void fontChanged();
+ void boldChanged();
+ void underlineChanged();
+ void italicChanged();
void textColorChanged();
void alignmentChanged();
diff --git a/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml b/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml
index 7d7554f44b..677d25fbd9 100644
--- a/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml
+++ b/examples/quickcontrols2/texteditor/qml/+touch/texteditor.qml
@@ -149,9 +149,6 @@ ApplicationWindow {
footer: ToolBar {
visible: !textArea.readOnly && textArea.activeFocus
- Material.primary: "#E0E0E0"
- Material.elevation: 0
-
Flickable {
anchors.fill: parent
contentWidth: toolRow.implicitWidth
diff --git a/examples/quickcontrols2/texteditor/qtquickcontrols2.conf b/examples/quickcontrols2/texteditor/qtquickcontrols2.conf
deleted file mode 100644
index ecac617fcb..0000000000
--- a/examples/quickcontrols2/texteditor/qtquickcontrols2.conf
+++ /dev/null
@@ -1,11 +0,0 @@
-[Controls]
-Style=Material
-
-[Material]
-Primary=White
-Foreground=#444444
-Accent=Blue
-Theme=System
-
-[Universal]
-Theme=System
diff --git a/examples/quickcontrols2/texteditor/texteditor.cpp b/examples/quickcontrols2/texteditor/texteditor.cpp
index 9b882dc803..72148c72ea 100644
--- a/examples/quickcontrols2/texteditor/texteditor.cpp
+++ b/examples/quickcontrols2/texteditor/texteditor.cpp
@@ -57,7 +57,6 @@
#include <QDebug>
#include <QQmlApplicationEngine>
#include <QQmlContext>
-#include <QQmlFileSelector>
#include <QQuickStyle>
#include "documenthandler.h"
@@ -87,7 +86,7 @@ int main(int argc, char *argv[])
#endif
QQmlApplicationEngine engine;
- QQmlFileSelector::get(&engine)->setExtraSelectors(selectors);
+ engine.setExtraFileSelectors(selectors);
engine.load(QUrl("qrc:/qml/texteditor.qml"));
if (engine.rootObjects().isEmpty())
diff --git a/examples/quickcontrols2/texteditor/texteditor.qrc b/examples/quickcontrols2/texteditor/texteditor.qrc
index 8f2da8432b..cdb7225a39 100644
--- a/examples/quickcontrols2/texteditor/texteditor.qrc
+++ b/examples/quickcontrols2/texteditor/texteditor.qrc
@@ -1,6 +1,5 @@
<RCC>
<qresource prefix="/">
- <file>qtquickcontrols2.conf</file>
<file>images/qt-logo.png</file>
<file>fonts/fontello.ttf</file>
<file>qml/texteditor.qml</file>