aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside2
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-01-04 12:41:58 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-01-04 14:11:16 +0000
commitff8f597b4581efa48074286cac6f9f1eb1827cd0 (patch)
treec429fbe3267e9d86353baad61dbcff5a57c0f58e /sources/pyside2
parentb628c1643cadb2a4a6fb88d336ebd4aace3bb06a (diff)
Pyside2: Add free functions from namespace QtQml
Change-Id: Ib4a9e8be733a3c8012e19c509ed98f87aad7cb6d Fixes: PYSIDE-892 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/pyside2')
-rw-r--r--sources/pyside2/PySide2/QtQml/CMakeLists.txt1
-rw-r--r--sources/pyside2/PySide2/QtQml/typesystem_qml.xml3
-rwxr-xr-xsources/pyside2/tests/QtQml/qquickview_test.py6
3 files changed, 9 insertions, 1 deletions
diff --git a/sources/pyside2/PySide2/QtQml/CMakeLists.txt b/sources/pyside2/PySide2/QtQml/CMakeLists.txt
index c584c3371..cfd1b6857 100644
--- a/sources/pyside2/PySide2/QtQml/CMakeLists.txt
+++ b/sources/pyside2/PySide2/QtQml/CMakeLists.txt
@@ -30,6 +30,7 @@ ${QtQml_GEN_DIR}/qqmlpropertymap_wrapper.cpp
${QtQml_GEN_DIR}/qqmlpropertyvaluesource_wrapper.cpp
${QtQml_GEN_DIR}/qqmlscriptstring_wrapper.cpp
${QtQml_GEN_DIR}/qqmlnetworkaccessmanagerfactory_wrapper.cpp
+${QtQml_GEN_DIR}/qtqml_wrapper.cpp
# module is always needed
${QtQml_GEN_DIR}/qtqml_module_wrapper.cpp
)
diff --git a/sources/pyside2/PySide2/QtQml/typesystem_qml.xml b/sources/pyside2/PySide2/QtQml/typesystem_qml.xml
index b0bdfaa27..250d1ea81 100644
--- a/sources/pyside2/PySide2/QtQml/typesystem_qml.xml
+++ b/sources/pyside2/PySide2/QtQml/typesystem_qml.xml
@@ -54,6 +54,9 @@
in generator tests folder. -->
</primitive-type>
+ <!-- For qmlEngine(const QObject*), qmlContext(const QObject*) in qqml.h -->
+ <namespace-type name="QtQml"/>
+
<add-function signature="qmlRegisterType(PyTypeObject,const char*,int,int,const char*)" return-type="int">
<inject-documentation format="target" mode="append">
This function registers the Python type in the QML system with the name qmlName, in the library imported from uri having the version number composed from versionMajor and versionMinor.
diff --git a/sources/pyside2/tests/QtQml/qquickview_test.py b/sources/pyside2/tests/QtQml/qquickview_test.py
index 1b503fa7e..62b20738f 100755
--- a/sources/pyside2/tests/QtQml/qquickview_test.py
+++ b/sources/pyside2/tests/QtQml/qquickview_test.py
@@ -33,6 +33,7 @@ import unittest
from helper import adjust_filename, TimedQApplication
from PySide2.QtCore import QUrl, QObject, Property, Slot
+from PySide2.QtQml import QtQml
from PySide2.QtQuick import QQuickView
class MyObject(QObject):
@@ -66,7 +67,10 @@ class TestQQuickView(TimedQApplication):
view.show()
self.assertEqual(view.status(), QQuickView.Ready)
-
+ rootObject = view.rootObject()
+ self.assertTrue(rootObject)
+ self.assertTrue(QtQml.qmlEngine(rootObject))
+ self.assertTrue(QtQml.qmlContext(rootObject))
def testModelExport(self):
view = QQuickView()