Commit Graph

2 Commits

Author SHA1 Message Date
Wladimir Leuschner fddba23321 Fix duplicate HighScore when replaying SameGame Example
The onClosed slot invokes SameGame.saveHighscore function
in samegame.js. Also the startNewGame function in samegame.js
is triggering the SameGame.saveHighscore function by calling
Dialog.hide, which in turn calls the onClosed slot. This leads
to duplicate highscore entries. Moving the closing of the
dialog after the clearing of the board/score and additionally
adding a condition that if the score is 0, no highscores are
saved, the duplication is avoided.

Fixes: QTBUG-119812
Pick-to: 6.7 6.6
Change-Id: I6aa433789f197a0d1e70abc82baf893934e53be5
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
2024-03-12 15:01:39 +00:00
Ulf Hermann a3ea7a9938 Fix samegame example to use QML modules
In this case it really makes no sense to use a shared directory because
we want to show the progressive changes between the different versions.
It's actually important to note that we're adding the pictures one by
one. Therefore, the shared directory is dissolved and the pictures added
duplicated into the respective versions of samegame.

Furthermore, moving the code into a "content" directory is a bad idea
because it complicates the import logic. We don't want to make the
"content" directory its own QML module. We might move samegame.qml into
the "content" directory, too, and apply some path wrangling to make it
work, but it's really not worth it here.

Pick-to: 6.2
Change-Id: Ifc45f48832596377c21bc6ef55e918ef487bc94e
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2021-08-31 11:26:10 +02:00