aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorElisabeth Ortega <ortega.elisabeth@gmail.com>2021-10-28 22:37:30 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-10-29 09:51:51 +0000
commit9299159e687da9b9435dde5261d83b8d019010c7 (patch)
tree1cec3ddafc1f3863b8ed2beee61f0a6715c16f7e /examples
parentecbe9eb420461390585ac7645299c285bbc3e5b6 (diff)
Fix invalid drawing of horizontal lines in the Qt Designer taskmenu example
In the TicTacToe game, consecutive states in different rows did incorrectly draw an horizontal line. Fix by letting the loop operate in steps of 3 as in the C++ example. Fixes: PYSIDE-1701 Change-Id: I325ece1d262510167d1182636814ff8d7aa85a3d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> (cherry picked from commit 07f9b2b674aca4f1d7b5f81ce25e1db08b165249) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/designer/taskmenuextension/tictactoe.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/designer/taskmenuextension/tictactoe.py b/examples/designer/taskmenuextension/tictactoe.py
index d4f8dff1a..ce806426f 100644
--- a/examples/designer/taskmenuextension/tictactoe.py
+++ b/examples/designer/taskmenuextension/tictactoe.py
@@ -124,7 +124,7 @@ class TicTacToe(QWidget):
painter.setPen(QPen(Qt.yellow, 3))
- for position in range(9):
+ for position in range(0, 8, 3):
if (self._state[position] != EMPTY
and self._state[position + 1] == self._state[position]
and self._state[position + 2] == self._state[position]):
@@ -137,7 +137,7 @@ class TicTacToe(QWidget):
and self._state[position + 3] == self._state[position]
and self._state[position + 6] == self._state[position]):
x = self._cell_rect(position).center().x()
- painter.drawLine(x, 0, x, height())
+ painter.drawLine(x, 0, x, self.height())
self._turn_number = 9
if (self._state[0] != EMPTY and self._state[4] == self._state[0]