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
Regular Contributor
Posts: 76
Registered: ‎07-31-2012
My Device: Blackberry
My Carrier: Vodafone
Accepted Solution

Binding Image View of a List View with QImage & PixelBuffer Data

Hi,

 

I need to develop a photo gallary like application. I need to load different images in a grid list view.

 

I can paint images on a single ImageView using PixelBufferData.

 

PixelBufferData pixelBuffer = PixelBufferData(PixelBufferData::RGBX, width, height, width, qimage.bits());

    Image image = Image(pixelBuffer);
    imageView->setImage(image);

 

Now I need to bind this with a grid list view. How to get paint ListItem Specific Image view.

 

ListView {
id: albumsListView
objectName: "albumsListView"
layout: GridListLayout {
columnCount: 5
 }

 

dataModel: XmlDataModel {
source: "models/album.xml"
}

listItemComponents: [
ListItemComponent {
type: "album"
MyListItem {
}
}
]

 

MyListItem is a Custom component:

 

Container {
 id: myItemContainer
layout: DockLayout {
}
Container {
layoutProperties: DockLayoutProperties {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Fill
}
layout: DockLayout {
}
ImageView {
id: coverImageView
objectName: "coverImageView"
imageSource: ListItemData.coverImage
preferredWidth: 250
preferredHeight: 250
}
Container {
background: Color.Black
opacity: 0.7
layout: DockLayout {
}
layoutProperties: DockLayoutProperties {
horizontalAlignment: HorizontalAlignment.Fill
verticalAlignment: VerticalAlignment.Bottom
}
Label {
text: ListItemData.name
layoutProperties: DockLayoutProperties {
horizontalAlignment: HorizontalAlignment.Center
verticalAlignment: VerticalAlignment.Bottom
}
textStyle {
base: SystemDefaults.TextStyles.BodyText
fontWeight: FontWeight.Bold
color: Color.White
}
}
}
}
}

 

I tried calling method in onCreationComplete of imageView & onImageSourceChanged of ImageView but didn't work.

Highlighted
Regular Contributor
Posts: 76
Registered: ‎07-31-2012
My Device: Blackberry
My Carrier: Vodafone

Re: Binding Image View of a List View with QImage & PixelBuffer Data

Well I did manage to find the solution.

 

I just used custom ListItemManager & ListItemListener to update image view in list & it worked fine.

 

You can refer below mentioned links for more info. Documentaion is quite good. Its very easy to understand & implement.

 

https://developer.blackberry.com/cascades/reference/bb__cascades__listitemmanager.html

https://developer.blackberry.com/cascades/reference/bb__cascades__listitemlistener.html

 

Sorry to bother you all.

 

Nishant Shah