Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
6.2.0, 6.2.1
-
None
-
-
3efe0b3e66 (pyside/pyside-setup/dev) 3577886cc8 (pyside/pyside-setup/6.2) 3577886cc8 (pyside/tqtc-pyside-setup/6.2) 3efe0b3e66 (pyside/tqtc-pyside-setup/dev) 3efe0b3e66 (pyside/tqtc-pyside-setup/tqtc/dev) 3577886cc8 (pyside/pyside-setup/6.2.3)
Description
It worked under 6.1.3 and is not working since 6.2.0
Workaround is to cast it directly with "QUrl().fromLocalFile"
Attached a working example
import sys import os from PySide6.QtCore import QUrl from PySide6.QtGui import QGuiApplication, QIcon from PySide6.QtQml import QQmlApplicationEngine if __name__ == "__main__": app = QGuiApplication([]) app.setApplicationName("Test") engine = QQmlApplicationEngine() path = os.path.dirname( os.path.realpath(__file__) ) qml_file_path = os.path.join(path, "qml","main2.qml") qml_file_url = QUrl.fromLocalFile( qml_file_path ) engine.load( qml_file_url ) if not engine.rootObjects(): sys.exit(-1) sys.exit( app.exec() )
Errors are something like
p usingmodel.py c:%5Cdev%5Cpyside%5Cpyside-setup%5Cexamples%5Cdeclarative%5Cusingmodel%5Cview.qml: Network error
Attachments
Issue Links
- resulted from
-
PYSIDE-1499 Migrate to pathlib.Path and Support __fspath__ in PySide
- Closed
For Gerrit Dashboard: PYSIDE-1736 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
386676,3 | PySide6: Fix QQmlApplicationEngine.load(str) to not construct a QUrl | dev | pyside/pyside-setup | Status: MERGED | +2 | 0 |
386719,2 | PySide6: Fix QQmlApplicationEngine.load(str) to not construct a QUrl | 6.2 | pyside/pyside-setup | Status: MERGED | +2 | 0 |