Commit Graph

10 Commits

Author SHA1 Message Date
Olivier De Cannière b322512f60 DiceSpawner: Fix qmllint warnings
-Add missing imports
-Bind ids inside of Components
-Explicitly require implcitly depended on index property
-Qualify lookups
-Cast reading as AccelerometerReading until it is exposed as the proper
 type

Also fix a binding loop when setting the die's position.

Fixes: QTBUG-138165
Pick-to: 6.10
Change-Id: I691d4a5bbf4cfbd8f7a6af0e837c15319f60343d
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2025-07-25 10:13:12 +02:00
Soheil Armin 48edb006a9 Dice: Improve initial position of dices
This change ensures proper initial distance of dices based
on their size. It also distributes them horizontally so that
they hit each other later at different angles.

Pick-to: 6.8 6.9 6.9.0
Change-Id: I7f8d2ab0c9b7b6b00996cae8fb121de950b68ca4
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2025-03-24 10:53:25 +00:00
Soheil Armin fc4f30767e Dice: Improve DiceSpawner and its property bindings
This change replaces the imperative logic of DiceSpawner
with a more declarative approach using Repeater3D.

It also replaces sending properties via functions, with
property binding and property aliases.

Pick-to: 6.8 6.9 6.9.0
Change-Id: Ic5c166fb50b0ede393cc72411f1a4a7e08a6ccd7
Reviewed-by: Nicholas Bennett <nicholas.bennett@qt.io>
2025-03-20 18:51:37 +02:00
Sami Shalayel c4d3c1690a dice demo: use qt_add_qml_module
Use qt_add_qml_module for the dice demo.

Make the demo qmllint clean by removing unused imports, unqualified
accesses and more.

Use loadFromModule instead of load, and rename main.qml to Main.qml to
be loadable. Also add a missing qmldir file for the qmake project to
work with loadFromModule, and fix the prefixes in the .pro file.

Pick-to: 6.8
Task-number: QTBUG-100100
Change-Id: I786dcb971980f48e91b0aeaf9d65f285a78c260e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2024-07-09 08:57:19 +02:00
Bartlomiej Moskal ffc1984fd3 QDice Example: Add a timer-guard for rolling dices
There is a problem in QQ3DPhysics. onBodyContact may still refer to
already deleted object - which causes the application to crash.
It happens when Accelerometer spam a lot with scene.spawnDice(...)
calls.

To avoid this crash, the timer-guard for rolling dices was added.

Pick-to: 6.7 6.6
Fixes: QTBUG-120364
Change-Id: I3ca3811662fb2400d61cb256c8b34885a6fe028a
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
2024-01-16 09:06:00 +01:00
Tuukka Turunen 84a7477e2a Add possibility to adjust dice size with a slider
New slider UI controls added to adjust dice size.

Pick-to: 6.7 6.6
Change-Id: Ie01efacff8eae0a33644f943bfd50d2cd258a7b1
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2024-01-12 11:04:10 +01:00
Nicholas Bennett 62b33327c0 Dice Demo: Add sound effects and shake to roll
Added the features in line with the spike outcome.
In addition, I modified the spawnDice function to
estimate if all dice are at rest before enabling spawning.
This prevents duplicate shake events and double tap
fumbles.

Task-number: QTBUG-116491
Pick-to: 6.6
Change-Id: Ia0dc59e469e008da5fc3afe2a7342381eadc1008
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
2023-09-02 03:40:04 +00:00
Kai Köhne 0bc36e534e Dice: Extract calculation of 45degrees
Don't calculate this inside the for loop.

Pick-to: 6.5 6.6
Change-Id: I09d46e363325071086332d901235f0feeabbb474
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
2023-08-14 18:25:28 +02:00
Kai Köhne 67d2885605 Reformat .qml files in dice example
Use qmlformat -i on all files.

Pick-to: 6.5 6.6
Change-Id: I163d1faf281fc085b824e092056cebe57fce5a6b
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
2023-06-22 17:27:34 +02:00
Jonas Karlsson 34ecd60038 Add the 'dice' example
Fixes: QTBUG-113600
Pick-to: 6.5 6.5.2 6.6
Change-Id: I13b8327f2dcf3e7eaec80c7c10038b22a1656df3
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
2023-06-21 00:50:04 +02:00