[Qt-interest] crash with QPixmap::fromImage(image);

Rohan McGovern rohan.mcgovern at nokia.com
Mon Jul 19 09:05:51 CEST 2010


ext Matthias Pospiech said:
> That could happen. But then I need to understand more about how QImage 
> uses the data. This is how the data gets there:
> 
> QImage QCameraSMX::image()
> {
>     return QImage((uchar*)d->frameArrayRgb, viewPort().width(), 
> viewPort().height(), QImage::Format_RGB888);
> }
> 
> 
> The data thus is raw, but I do not want QImage to rely on its validity, 
> I want it to copy the data.
> So how would I do that?

Try using QImage::fromData or QImage::loadFromData instead.

> And what effect might the copy of the QImage have?

It'll add some memory consumption and some runtime to your app :-)
-- 
Rohan McGovern
QA Engineer
Qt Development Frameworks, Nokia



More information about the Qt-interest-old mailing list