From d898e002380e2b8808592b6e0e05c689e1b37bd8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 20 Jan 2022 17:33:10 +0100 Subject: Examples: Remove remaining qmlRegisterType() Pick-to: 6.2 Task-number: PYSIDE-841 Change-Id: I2c3f9b22a3c1fdc6ddbdd7f08db38db613274cfd Reviewed-by: Cristian Maureira-Fredes --- examples/declarative/extending/chapter1-basics/basics.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'examples/declarative/extending/chapter1-basics') diff --git a/examples/declarative/extending/chapter1-basics/basics.py b/examples/declarative/extending/chapter1-basics/basics.py index 412b25cad..b05695800 100644 --- a/examples/declarative/extending/chapter1-basics/basics.py +++ b/examples/declarative/extending/chapter1-basics/basics.py @@ -47,10 +47,16 @@ import sys from PySide6.QtCore import Property, Signal, QUrl from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor -from PySide6.QtQml import qmlRegisterType +from PySide6.QtQml import QmlElement from PySide6.QtQuick import QQuickPaintedItem, QQuickView +# To be used on the @QmlElement decorator +# (QML_IMPORT_MINOR_VERSION is optional) +QML_IMPORT_NAME = "Charts" +QML_IMPORT_MAJOR_VERSION = 1 + +@QmlElement class PieChart (QQuickPaintedItem): nameChanged = Signal() @@ -86,8 +92,6 @@ class PieChart (QQuickPaintedItem): if __name__ == '__main__': app = QGuiApplication(sys.argv) - qmlRegisterType(PieChart, 'Charts', 1, 0, 'PieChart') - view = QQuickView() view.setResizeMode(QQuickView.SizeRootObjectToView) qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml') -- cgit v1.2.3