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
New Developer
silajim
Posts: 27
Registered: ‎10-14-2013
My Device: Z10
Accepted Solution

List of QUrl's to QML

HI all,

I want to pass a datamodel containing the paths (QUrl's) of external images to be loaded in a listview (in a standardListItem). How I can do it? I have tried a Groupdatamodel from a Qvariantmap but instead of displaying the image it displays the path (file:///accounts/1000/shared/camera/IMG_00000013.jpg). I don't think i have an error in the Qurl retriving code, but here it is:

	QList<NotebookEntryAttachment> attachemnts = note.attachments();
	    	foreach(const NotebookEntryAttachment &_attach, attachemnts)
	    	{
	    		if(_attach.mimeType()=="image/jpeg")
	    		{
	    			QVariantMap attachemnt;
	    			QString workingDir = QDir::currentPath();
	    			attachemnt["uri"]=QUrl("file://" +workingDir+ _attach.dataId().toLocalFile());
	    		        attach->insert(new QUrl("file://" +workingDir+ _attach.dataId().toLocalFile()));
	    		}
	    	}

 Thank you!

 

 

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: List of QUrl's to QML

welcome to the support forums.
i would suggest to use a string instead of QUrl.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
New Developer
silajim
Posts: 27
Registered: ‎10-14-2013
My Device: Z10

Re: List of QUrl's to QML

Thank you i resolved my problem, it was the url passed, it wasn't "valid".

Now I have another problem when i load about 10-20 photos, the list is laggy? Why is that? How it can be fixed? I use Imagesource: ListItemData...
Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: List of QUrl's to QML

please mark this thread as solved and open a new thread for a new question, this makes it easier for others to help you.

i think the loading of an image was controlled by using an absolute or relative path, one happens async, but i am not sure where to confirm that right now.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter