Select to view content in your preferred language

How to get the absolute path of a file/image

1806
1
01-07-2021 07:45 AM
x_d
by
Regular Contributor

I need absolute path of a file suppose my path structure is like this

-myProject_Folder
    ~assets_folder
       -images_folder
    ~demo_folder
        -first_page.qml
Here i want to show the image
                   Image {
                        id: img
                        height:200
                        width:200
                        source:"../assets/images/imageName.png" 
                        fillMode: Image.PreserveAspectFit
                        anchors.centerIn: parent
                    }

By using this "../assets/images/imagename.png"  the image is showing on normal pages, but on map pages where i have to show the marker images and tracking image , these are not showing. And I also have tried this  Qt.resolvedUrl (URL), it is also not working. Doesn't shows any error but images are also not showing.  Is there anything to get an absolute file path so that it will work in every device and every page. 

also while testing the app on android device the images are showing but on iphone it's not showing. I don't understand what's wrong. 

Tags (2)
1 Reply
VictorTey
Esri Contributor

You can do /project_folder/whatever/whatever

That will always reference from your project folder. 

0 Kudos