Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
smiley
Posts: 1,497
Registered: ‎07-14-2008
My Device: Z10
Accepted Solution

Data Model with ImageView not displaying the picture on OS10.1

in the qml i have a ListView with a DataModel.  The DataModel contains a Label and ImageView.

 

I set the ImageView and Label like this

 

            QVariantMap entry;

            QFile file(picture_file);  // file stored on the device
            QFileInfo fileInfo(file);
            QString qmlPath(fileInfo.absoluteFilePath());

// the file path would like something like this

// /accounts/1000/appdata/com.example.TestApp.testDev_e_TestApp4a417186/shared/photos/TestApp/myPicture.png


            entry["image"] = QUrl(qmlPath);
            entry["name"] = "Text";

this all works on 10.0.9 but when I recompile the app target to 10.1 or higher the picture does not show up.  The label does.

 

Also, if i set the imagesource to the asset folder the image shows up fine.

 

          entry["image"] = "asset:///images/template.png";

 

What is the correct way to set the imageSource for ImageView?

 

 

 

 

 

 

Contributor
scl77
Posts: 12
Registered: ‎05-15-2013
My Device: Z10

Re: Data Model with ImageView not displaying the picture on OS10.1

I think adding file:// in front of your file path will fix your problem.