diff options
author | Cristián Maureira-Fredes <[email protected]> | 2021-06-28 16:42:55 +0200 |
---|---|---|
committer | Cristián Maureira-Fredes <[email protected]> | 2021-07-21 10:01:45 +0200 |
commit | c9330b0acf680d4c2a0933b8bf67dc9b3114de5d (patch) | |
tree | f58d82c3ce57f04960e39f3af596e5a010f21a7f /sources/pyside6/tests/QtQml/bug_814.py | |
parent | b1b2cc2ebed2fcf6e31c1fbbdd3638216e34717b (diff) |
qml: replace context properties and code updates
Most of the qml code in the repository was outdated,
and followed bad practices, like context properties.
Complementary, after the major updates for Qt6
most of the code was not relying on the new ways of
register types (singletons, and using the decorator QmlElement).
Drop the context property usage in the following examples:
- signals/qmltopy1
- signals/qmltopy2
- signals/pytoqml2
- usingmodel
- quickcontrols2/gallery
- textproperties
Additionally:
- all the tests related to context properties
- tutorials/qmlapp
- tutorials/qmlsqlintegration
- Removing 'scrolling' example
- Fixing some flake8 warnings
Change-Id: I649248c0149876bf2bf94e78e27cef7110f42f1d
Reviewed-by: Friedemann Kleint <[email protected]>
Reviewed-by: Qt CI Bot <[email protected]>
Reviewed-by: Keith Kyzivat <[email protected]>
Diffstat (limited to 'sources/pyside6/tests/QtQml/bug_814.py')
-rw-r--r-- | sources/pyside6/tests/QtQml/bug_814.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sources/pyside6/tests/QtQml/bug_814.py b/sources/pyside6/tests/QtQml/bug_814.py index 05cd440f1..599a95e87 100644 --- a/sources/pyside6/tests/QtQml/bug_814.py +++ b/sources/pyside6/tests/QtQml/bug_814.py @@ -51,8 +51,12 @@ from helper.timedqapplication import TimedQApplication from PySide6.QtCore import QUrl, QAbstractListModel, QModelIndex, Qt from PySide6.QtQuick import QQuickView +from PySide6.QtQml import QmlElement +QML_IMPORT_NAME = "test.ListModel" +QML_IMPORT_MAJOR_VERSION = 1 +@QmlElement class ListModel(QAbstractListModel): def __init__(self): super().__init__() @@ -73,7 +77,7 @@ class TestBug814(TimedQApplication): def testAbstractItemModelTransferToQML(self): view = QQuickView() model = ListModel() - view.rootContext().setContextProperty("pythonModel", model) + view.setInitialProperties({"pythonModel": model}) file = Path(__file__).resolve().parent / 'bug_814.qml' self.assertTrue(file.is_file()) view.setSource(QUrl.fromLocalFile(file)) |