aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorElisabeth Ortega <ortega.elisabeth@gmail.com>2021-10-28 22:37:30 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-10-29 07:45:26 +0000
commit07f9b2b674aca4f1d7b5f81ce25e1db08b165249 (patch)
treeeff589529ee55c20335ad9d02e6e03c2423edd90 /examples
parent0c6eb7cd232fff9d81a8d5bc9a7fd71d9b8c67f5 (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. Pick-to: 6.2 Fixes: PYSIDE-1701 Change-Id: I325ece1d262510167d1182636814ff8d7aa85a3d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
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]