diff options
-rw-r--r-- | sources/pyside6/PySide6/QtQml/typesystem_qml.xml | 19 | ||||
-rw-r--r-- | sources/pyside6/tests/QtQml/registertype.py | 11 |
2 files changed, 28 insertions, 2 deletions
diff --git a/sources/pyside6/PySide6/QtQml/typesystem_qml.xml b/sources/pyside6/PySide6/QtQml/typesystem_qml.xml index 6943e4ac6..a42bd9e08 100644 --- a/sources/pyside6/PySide6/QtQml/typesystem_qml.xml +++ b/sources/pyside6/PySide6/QtQml/typesystem_qml.xml @@ -101,6 +101,25 @@ <inject-code class="target" file="../glue/qtqml.cpp" snippet="qmlelement"/> </add-function> + <function signature="qjsEngine(const QObject*)"> + <modify-function> + <modify-argument index="return" pyi-type="Optional[PySide6.QtQml.QJSEngine]"/> + </modify-function> + </function> + <function signature="qmlClearTypeRegistrations()"/> + <function signature="qmlContext(const QObject*)"> + <modify-function> + <modify-argument index="return" pyi-type="Optional[PySide6.QtQml.QQmlContext]"/> + </modify-function> + </function> + <function signature="qmlEngine(const QObject*)"> + <modify-function> + <modify-argument index="return" pyi-type="Optional[PySide6.QtQml.QQmlEngine]"/> + </modify-function> + </function> + <function signature="qmlProtectModule(const char*,int)"/> + <function signature="qmlRegisterModule(const char*,int,int)"/> + <enum-type identified-by-value="QML_HAS_ATTACHED_PROPERTIES"> <extra-includes> <include file-name="QtQml" location="global"/> diff --git a/sources/pyside6/tests/QtQml/registertype.py b/sources/pyside6/tests/QtQml/registertype.py index 53d5b8542..2bd91f2db 100644 --- a/sources/pyside6/tests/QtQml/registertype.py +++ b/sources/pyside6/tests/QtQml/registertype.py @@ -39,9 +39,11 @@ from helper.helper import quickview_errorstring from PySide6.QtCore import Property, QObject, QTimer, QUrl from PySide6.QtGui import QGuiApplication, QPen, QColor, QPainter -from PySide6.QtQml import qmlRegisterType, ListProperty, QmlElement +from PySide6.QtQml import (qjsEngine, qmlContext, qmlEngine, qmlRegisterType, + ListProperty, QmlElement) from PySide6.QtQuick import QQuickView, QQuickItem, QQuickPaintedItem + QML_IMPORT_NAME = "Charts" QML_IMPORT_MAJOR_VERSION = 1 @@ -122,7 +124,12 @@ class TestQmlSupport(unittest.TestCase): file = Path(__file__).resolve().parent / 'registertype.qml' self.assertTrue(file.is_file()) view.setSource(QUrl.fromLocalFile(os.fspath(file))) - self.assertTrue(view.rootObject(), quickview_errorstring(view)) + root_object = view.rootObject() + self.assertTrue(root_object, quickview_errorstring(view)) + self.assertTrue(qjsEngine(root_object)) + self.assertEqual(qmlEngine(root_object), view.engine()) + self.assertTrue(qmlContext(root_object)) + view.show() QTimer.singleShot(250, view.close) app.exec() |