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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Developer
Posts: 27
Registered: ‎11-13-2013
My Device: Q10
My Carrier: Verizon
Accepted Solution

Get file thumbnail for ListView

Is there a way to get the thumbnail image of a picture? I have a listview showing a list of selected pictures and I want to display the thumbnail along with the name of the file. Here is what I have so far

 

I let the user select a picture thru the file picker which only returns the file path I then pass that path into the a method to add it to the datamodel.

 

CPP file: I pass in the file path to the picture that was selected

            QVariantMap itemMap;
	    QFileInfo fileInfo = QFileInfo(filePath);
	    itemMap["name"] = QVariant(fileInfo.fileName());
	    itemMap["image"] = QVariant(fileInfo.filePath());

	    if (indexOf(itemMap) == -1)
	    {
	           insert(0, itemMap);
	     }
  

 ListItem QML

 

StandardListItem
{
    id:pictureItem
    title: ListItemData.name
    imageSpaceReserved: true
    imagesource: ListItemData.image
    
}

 

I'm fairly new to this so I have a really strong feeling I'm going about this the wrong way but I notice I get an error message saying it cannot access item in <file path> . My thinking was that the image space would shrink the image to fit in the reserved space

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Get file thumbnail for ListView

For the error do you have the access_shared permission set? 

 

I would suggest you should be creating thumbnails of the images, saving them in the apps data folder and updating the ListItem image.

If you experience a lag when populating the ListView then you should think about preloading some images and caching.


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.
Highlighted
New Developer
Posts: 27
Registered: ‎11-13-2013
My Device: Q10
My Carrier: Verizon

Re: Get file thumbnail for ListView

No I do not have acess to share permissions set, I will do that,

 

Creating and saving the thumbnail images will be time consuming no? I allow them to select multiple photos at once, unless the method that creates the thumbnails and save them in the appdata folder runs in the background

Developer
Posts: 828
Registered: ‎10-16-2012
My Device: Red Z10
My Carrier: Rogers

Re: Get file thumbnail for ListView

[ Edited ]

this is a very in depth example of how to do this, just download and run the program and you'll notice the excellent performance

 

http://supportforums.blackberry.com/t5/Native-Development/Wappy-a-complete-free-and-open-source-BB10...

New Developer
Posts: 27
Registered: ‎11-13-2013
My Device: Q10
My Carrier: Verizon

Re: Get file thumbnail for ListView

[ Edited ]

That looks like that would work  thanks to both of you guys!

Developer
Posts: 6,152
Registered: ‎07-05-2012
My Device: Playbook, Dev Alpha C, Z10 LE, Z30
My Carrier: Orange

Re: Get file thumbnail for ListView

Yes, I meant asynchronously (in the background) forgot that part in the actual response.

 

Best of luck.

 


If you've been helped click on Like Button, if you've been saved buy the app. Smiley Happy

Developer of stokLocker, Sympatico and Super Sentences.