aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXU, KE <tarcadia@qq.com>2023-08-05 17:36:26 +0800
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-08-07 13:24:54 +0000
commit787a09b9d71957485b977b23f08fa212fefce615 (patch)
tree011db85695e65a534eaa0d81025d58acd69b78a0
parentf68191b651774057e3d4b351587965ab80c7f9dc (diff)
examples: Fix Tetrix line-removing bug
When Tetrix example runs, a full line of blocks will remove itself and any other lines below. The root cause is the code only removes the lowest line as it would be the full line but a full line can be at not only the bottom. And this lead to a continuous full-line-finding and removes the lowest line again and again until the full line is removed. This fix introduced a minor fix by changing the index of traversing through the lines to be moved down. This modification allows removing a line that is not at the bottom and fixes the bug. Fixes: PYSIDE-2412 Change-Id: I7b23bc82b9baac720152a1d93e242df29b82f768 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit a7c4a88f5700ab6f0f7244fbdb44435ba30833af) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--examples/widgets/widgets/tetrix/tetrix.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/widgets/widgets/tetrix/tetrix.py b/examples/widgets/widgets/tetrix/tetrix.py
index 3accd557a..36cbb3448 100644
--- a/examples/widgets/widgets/tetrix/tetrix.py
+++ b/examples/widgets/widgets/tetrix/tetrix.py
@@ -283,7 +283,7 @@ class TetrixBoard(QFrame):
if line_is_full:
num_full_lines += 1
- for k in range(TetrixBoard.board_height - 1):
+ for k in range(i, TetrixBoard.board_height - 1):
for j in range(TetrixBoard.board_width):
self.set_shape_at(j, k, self.shape_at(j, k + 1))