aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/extending/chapter5-listproperties/listproperties.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/declarative/extending/chapter5-listproperties/listproperties.py')
-rw-r--r--examples/declarative/extending/chapter5-listproperties/listproperties.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/declarative/extending/chapter5-listproperties/listproperties.py b/examples/declarative/extending/chapter5-listproperties/listproperties.py
index 646a14458..4f24a3a87 100644
--- a/examples/declarative/extending/chapter5-listproperties/listproperties.py
+++ b/examples/declarative/extending/chapter5-listproperties/listproperties.py
@@ -50,8 +50,9 @@ from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor
from PySide6.QtQml import qmlRegisterType, ListProperty
from PySide6.QtQuick import QQuickPaintedItem, QQuickView, QQuickItem
+
class PieSlice (QQuickPaintedItem):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QQuickPaintedItem.__init__(self, parent)
self._color = QColor()
self._fromAngle = 0
@@ -85,10 +86,11 @@ class PieSlice (QQuickPaintedItem):
pen = QPen(self._color, 2)
painter.setPen(pen)
painter.setRenderHints(QPainter.Antialiasing, True)
- painter.drawPie(self.boundingRect().adjusted(1,1,-1,-1), self._fromAngle * 16, self._angleSpan * 16)
+ painter.drawPie(self.boundingRect().adjusted(1, 1, -1, -1), self._fromAngle * 16, self._angleSpan * 16)
+
class PieChart (QQuickItem):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
QQuickItem.__init__(self, parent)
self._name = u''
self._slices = []
@@ -107,6 +109,7 @@ class PieChart (QQuickItem):
slices = ListProperty(PieSlice, appendSlice)
+
if __name__ == '__main__':
app = QGuiApplication(sys.argv)