10-18-2012 03:18 PM
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?
10-18-2012 03:44 PM
Have you looked at this knowledge base article? it may help point you in the correct direction
Martin
10-19-2012 06:58 AM
thanks, unfortunately, the page with sources on github doesnt exists anymore
10-19-2012 07:41 AM
I think to create CustomControl, where QImpage will be converted to Image
Do I moving to right direction?
10-19-2012 08:46 AM
Hmm that is odd, they did take it out..I'll have to look into it, the recommended way may have changed :/
10-19-2012 08:56 AM
thanks. waiting for new recommended way ![]()
10-20-2012 12:08 AM
I think its removed cause bb::cascades:
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."
10-20-2012 08:53 AM
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.
10-20-2012 08:55 AM
ok, but how to propagate the Image to ImageView ?
10-20-2012 09:00 AM
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)