diff options
Diffstat (limited to 'examples/qml/tutorials/extending-qml/chapter1-basics')
| -rw-r--r-- | examples/qml/tutorials/extending-qml/chapter1-basics/Charts/App.qml (renamed from examples/qml/tutorials/extending-qml/chapter1-basics/app.qml) | 8 | ||||
| -rw-r--r-- | examples/qml/tutorials/extending-qml/chapter1-basics/Charts/qmldir | 4 | ||||
| -rw-r--r-- | examples/qml/tutorials/extending-qml/chapter1-basics/basics.py | 7 | ||||
| -rw-r--r-- | examples/qml/tutorials/extending-qml/chapter1-basics/chapter1-basics.pyproject | 2 |
4 files changed, 10 insertions, 11 deletions
diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/app.qml b/examples/qml/tutorials/extending-qml/chapter1-basics/Charts/App.qml index 6feef5633..523dc7128 100644 --- a/examples/qml/tutorials/extending-qml/chapter1-basics/app.qml +++ b/examples/qml/tutorials/extending-qml/chapter1-basics/Charts/App.qml @@ -1,4 +1,4 @@ -// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2017 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause import Charts @@ -16,11 +16,7 @@ Item { } Text { - anchors { - bottom: parent.bottom; - horizontalCenter: parent.horizontalCenter; - bottomMargin: 20 - } + anchors { bottom: parent.bottom; horizontalCenter: parent.horizontalCenter; bottomMargin: 20 } text: aPieChart.name } } diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/Charts/qmldir b/examples/qml/tutorials/extending-qml/chapter1-basics/Charts/qmldir new file mode 100644 index 000000000..78602c6b4 --- /dev/null +++ b/examples/qml/tutorials/extending-qml/chapter1-basics/Charts/qmldir @@ -0,0 +1,4 @@ +module Charts +typeinfo chapter1-basics.qmltypes +depends QtQuick +App 254.0 App.qml diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py b/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py index 322bef954..08fa91c14 100644 --- a/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py +++ b/examples/qml/tutorials/extending-qml/chapter1-basics/basics.py @@ -4,11 +4,10 @@ from __future__ import annotations """PySide6 port of the qml/tutorials/extending-qml/chapter1-basics example from Qt v5.x""" -import os from pathlib import Path import sys -from PySide6.QtCore import Property, Signal, QUrl +from PySide6.QtCore import Property, Signal from PySide6.QtGui import QGuiApplication, QPen, QPainter, QColor from PySide6.QtQml import QmlElement from PySide6.QtQuick import QQuickPaintedItem, QQuickView @@ -57,8 +56,8 @@ if __name__ == '__main__': view = QQuickView() view.setResizeMode(QQuickView.ResizeMode.SizeRootObjectToView) - qml_file = os.fspath(Path(__file__).resolve().parent / 'app.qml') - view.setSource(QUrl.fromLocalFile(qml_file)) + view.engine().addImportPath(Path(__file__).parent) + view.loadFromModule("Charts", "App") if view.status() == QQuickView.Status.Error: sys.exit(-1) view.show() diff --git a/examples/qml/tutorials/extending-qml/chapter1-basics/chapter1-basics.pyproject b/examples/qml/tutorials/extending-qml/chapter1-basics/chapter1-basics.pyproject index 869556bb8..2207b8344 100644 --- a/examples/qml/tutorials/extending-qml/chapter1-basics/chapter1-basics.pyproject +++ b/examples/qml/tutorials/extending-qml/chapter1-basics/chapter1-basics.pyproject @@ -1,3 +1,3 @@ { - "files": ["basics.py", "app.qml"] + "files": ["basics.py", "Charts/App.qml", "Charts/qmldir"] } |
