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. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Cascades Development

Reply
New Developer
vladest
Posts: 88
Registered: ‎06-16-2012
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
Please use plain text.
Developer
martin78
Posts: 27
Registered: ‎05-15-2012
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/
Please use plain text.
New Developer
vladest
Posts: 88
Registered: ‎06-16-2012
My Carrier: Kievstar

Re: Container showing QImage

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

Qt/Symbian/Meego/BB10/Cascades developer
Please use plain text.
New Developer
vladest
Posts: 88
Registered: ‎06-16-2012
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
Please use plain text.
Developer
martin78
Posts: 27
Registered: ‎05-15-2012
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/
Please use plain text.
New Developer
vladest
Posts: 88
Registered: ‎06-16-2012
My Carrier: Kievstar

Re: Container showing QImage

thanks. waiting for new recommended way :smileyhappy:

Qt/Symbian/Meego/BB10/Cascades developer
Please use plain text.
New Developer
vladest
Posts: 88
Registered: ‎06-16-2012
My Carrier: Kievstar

Re: Container showing QImage

I think its removed cause bb::cascades::smileytongue:ixelBufferData 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
Please use plain text.
Developer
Dredvard
Posts: 154
Registered: ‎01-27-2012
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"
Please use plain text.
New Developer
vladest
Posts: 88
Registered: ‎06-16-2012
My Carrier: Kievstar

Re: Container showing QImage

ok, but how to propagate the Image to ImageView ?

Qt/Symbian/Meego/BB10/Cascades developer
Please use plain text.
Developer
Dredvard
Posts: 154
Registered: ‎01-27-2012
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"
Please use plain text.