-
Bug
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
QDS 4.7.2
-
None
Minimal reproduction project: https://git.qt.io/mikio_hirai/qdspathissue#
2D view and runtime resolve asset paths differently when the path is calculated during runtime.
The project structure is:
PathIssueContent(folder)
– App.qml
– CustomTypes(folder)
– Dog.qml
– dog.png
– doge.png
In Dog.qml, it calculates source property during runtime.
import QtQuick Image { enum DogType { Dog, Doge } property int type: Dog.Dog source: type === Dog.Dog ? "dog.png" : "doge.png" }
App.qml uses Dog.qml.
As you can see, 2D View correctly shows the image.
However, when the app is run, it doesn't show the image.
With this warning:
11:50:37: Starting C:\Qt\Tools\QtDesignStudio\qt6_design_studio_reduced_version\bin\qmlpuppet-4.7.2.exe --qml-runtime -I C:/Users/81808/Downloads/PathIssue/. --apptype widget C:/Users/81808/Downloads/PathIssue/PathIssueContent/App.qml... 11:50:37: Cannot retrieve debugging output. QML debugging is enabled. Only use this in a safe environment. Info: Starting QML Runtime Warning: file:///C:/Users/81808/Downloads/PathIssue/PathIssueContent/App.qml:12:5: QML Dog: Cannot open: file:///C:/Users/81808/Downloads/PathIssue/PathIssueContent/dog.png
Here, in runtime, the path in Dog.qml is resolved relative to the file using Dog.qml, which is App.qml.
In my opinion, it seems natural to align the runtime path resolution to the way 2D view does; paths are resolved relative to the file refering to them.