I have the two qml files A and B. Both are in different directories.
A is used in B and should display an image, which is located in the directory of B.
But if I set the source of the image in A to “imageName.png” it doesn’t work, since it uses the relative path of A and not of B.
So how can I use the relative path of B in A?
Here is an example:
/path/to/A.qml:
Rectangle {
property string imageSource
Image { source: imageSource }
}
/other/Path/to/B.qml:
Rectangle {
A {
imageSource: "image.png"
}
}
Image is located at /other/Path/to/image.png (which is the path of B.qml)
The error message is like: Cannot find /path/to/image.png, which shows that the relative path of A.qml is used and not of B.qml
So how can I use the relative path of B.qml in order to set the right path to the image for A.qml?
↧