aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6
diff options
context:
space:
mode:
authorJaime Resano <Jaime.Resano-Aisa@qt.io>2024-11-22 15:51:18 +0100
committerJaime Resano <Jaime.RESANO-AISA@qt.io>2024-11-25 11:11:46 +0000
commit4274aaed897e713fc628e4dcec93ac6a5f704af0 (patch)
treed19345c8d515988857fb78a3f6d203b00cd23a1f /sources/pyside6
parent78ac4b40a5da489036885def98e5108fdd56cdbc (diff)
Delete QQmlApplicationEngine on application exit
Due to the API limitations, we have to ensure that the engine is deleted before other parts of the application is deleted. Otherwise exposing objects using setInitialProperties() or setContextProperty() for example will cause warnings to be printed. It is a good practice to always delete the engine manually so all the code should be consistent. Task-number: PYSIDE-1612 Pick-to: 6.8 Change-Id: I01f16359e9d90cefd5957708fe12ce489bd7edc0 Reviewed-by: Jaime Resano <Jaime.RESANO-AISA@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/pyside6')
-rw-r--r--sources/pyside6/doc/tutorials/extendedexplorer/main.py8
-rw-r--r--sources/pyside6/doc/tutorials/qmlintegration/main.py4
-rw-r--r--sources/pyside6/doc/tutorials/qmlsqlintegration/main.py3
3 files changed, 9 insertions, 6 deletions
diff --git a/sources/pyside6/doc/tutorials/extendedexplorer/main.py b/sources/pyside6/doc/tutorials/extendedexplorer/main.py
index 4afb08b6d..13a1c5e5b 100644
--- a/sources/pyside6/doc/tutorials/extendedexplorer/main.py
+++ b/sources/pyside6/doc/tutorials/extendedexplorer/main.py
@@ -11,8 +11,8 @@ This example shows how to customize Qt Quick Controls by implementing a simple f
# import FileSystemModule.rc_icons
# import FileSystemModule.rc_app
-from scheme_manager import SchemeManager
-from editormodels import FileSystemModel
+from scheme_manager import SchemeManager # noqa: F401
+from editormodels import FileSystemModel # noqa: F401
import PySide6
from PySide6.QtGui import QGuiApplication, QIcon
from PySide6.QtQml import QQmlApplicationEngine
@@ -48,4 +48,6 @@ if __name__ == '__main__':
fsm = engine.singletonInstance("FileSystemModule", "FileSystemModel")
fsm.setInitialDirectory(args[0])
- sys.exit(app.exec())
+ exit_code = app.exec()
+ del engine
+ sys.exit(exit_code)
diff --git a/sources/pyside6/doc/tutorials/qmlintegration/main.py b/sources/pyside6/doc/tutorials/qmlintegration/main.py
index f08ad099f..aa8706f93 100644
--- a/sources/pyside6/doc/tutorials/qmlintegration/main.py
+++ b/sources/pyside6/doc/tutorials/qmlintegration/main.py
@@ -59,6 +59,6 @@ if __name__ == '__main__':
if not engine.rootObjects():
sys.exit(-1)
- ex = app.exec()
+ exit_code = app.exec()
del engine
- sys.exit(ex)
+ sys.exit(exit_code)
diff --git a/sources/pyside6/doc/tutorials/qmlsqlintegration/main.py b/sources/pyside6/doc/tutorials/qmlsqlintegration/main.py
index e42f8f2e9..e514adda8 100644
--- a/sources/pyside6/doc/tutorials/qmlsqlintegration/main.py
+++ b/sources/pyside6/doc/tutorials/qmlsqlintegration/main.py
@@ -55,5 +55,6 @@ if __name__ == "__main__":
if not engine.rootObjects():
sys.exit(-1)
- app.exec()
+ exit_code = app.exec()
del engine
+ sys.exit(exit_code)