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
Posts: 88
Registered: ‎06-16-2012
My Device: N950/E7/N808/N9/X7/BB10 Alpha
My Carrier: Kievstar

Container showing QImage

is there is already implemented some kind of container, which shows Qimage and supporting scrolling and resizing?

If not, where to look at examples how to implement such kind of containers for Cascades?

May be I dont need a container but something else?

Qt/Symbian/Meego/BB10/Cascades developer
Developer
Posts: 27
Registered: ‎05-15-2012
My Device: Dev Alpha B
My Carrier: Bell

Re: Container showing QImage

Have you looked at this knowledge base article? it may help point you in the correct direction

 

http://supportforums.blackberry.com/t5/Cascades-Development-Knowledge/Using-QImage-and-QPainter-to-P...

 

Martin

 

------------------------------------------
Macadamian Technologies Inc.
http://www.macadamian.com/
New Developer
Posts: 88
Registered: ‎06-16-2012
My Device: N950/E7/N808/N9/X7/BB10 Alpha
My Carrier: Kievstar

Re: Container showing QImage

thanks, unfortunately, the page with sources on github doesnt exists anymore

Qt/Symbian/Meego/BB10/Cascades developer
New Developer
Posts: 88
Registered: ‎06-16-2012
My Device: N950/E7/N808/N9/X7/BB10 Alpha
My Carrier: Kievstar

Re: Container showing QImage

I think to create CustomControl, where QImpage will be converted to Image

Do I moving to right direction?

Qt/Symbian/Meego/BB10/Cascades developer
Developer
Posts: 27
Registered: ‎05-15-2012
My Device: Dev Alpha B
My Carrier: Bell

Re: Container showing QImage

Hmm that is odd, they did take it out..I'll have to look into it, the recommended way may have changed :/

------------------------------------------
Macadamian Technologies Inc.
http://www.macadamian.com/
New Developer
Posts: 88
Registered: ‎06-16-2012
My Device: N950/E7/N808/N9/X7/BB10 Alpha
My Carrier: Kievstar

Re: Container showing QImage

thanks. waiting for new recommended way Smiley Happy

Qt/Symbian/Meego/BB10/Cascades developer
New Developer
Posts: 88
Registered: ‎06-16-2012
My Device: N950/E7/N808/N9/X7/BB10 Alpha
My Carrier: Kievstar

Re: Container showing QImage

I think its removed cause bb::cascades:Smiley TongueixelBufferData api doesnt exists anymore

so, the question still remains - how to show a pixel buffer in QML?

ImageData will not work because: "ImageData based images are different from other images in that they don't report state changes and they are not trackable through ImageTracker. They are also not available from QML."

Qt/Symbian/Meego/BB10/Cascades developer
Developer
Posts: 160
Registered: ‎01-27-2012
My Device: Playbook
My Carrier: Rogers

Re: Container showing QImage

Try this

 

//returns unmirroed image
static bb::cascades::Image fromQImage(const QImage &qImage) {
	bb::ImageData imageData(bb::PixelFormat::RGBA_Premultiplied, qImage.width(),
			qImage.height());

	unsigned char *dstLine = imageData.pixels();
	for (int y = 0; y < imageData.height(); y++) {
		unsigned char * dst = dstLine;
		for (int x = 0; x < imageData.width(); x++) {
			QRgb srcPixel = qImage.pixel(x, y);
			*dst++ = qRed(srcPixel);
			*dst++ = qGreen(srcPixel);
			*dst++ = qBlue(srcPixel);
			*dst++ = qAlpha(srcPixel);
		}
		dstLine += imageData.bytesPerLine();
	}

	return imageData;
}

 Now you'll have an Image intested of a QImage.

---
If you find my post helpful please "like" it and "accept as a solution"
New Developer
Posts: 88
Registered: ‎06-16-2012
My Device: N950/E7/N808/N9/X7/BB10 Alpha
My Carrier: Kievstar

Re: Container showing QImage

ok, but how to propagate the Image to ImageView ?

Qt/Symbian/Meego/BB10/Cascades developer
Developer
Posts: 160
Registered: ‎01-27-2012
My Device: Playbook
My Carrier: Rogers

Re: Container showing QImage

Bunch of ways you can do it.  I made an imageScaler class based on an ImageTracker and then onLoaded  then set imageviewID.image=imagescaler.image

 

In cpp you can use:

Q_SLOT voidsetImage (const Image &image)

---
If you find my post helpful please "like" it and "accept as a solution"