Qt中无法load big image的问题

1、在Qt中,当播放一些比较大的图片时,图片无法显示,出现:QImage: out of memory, returning null image

参考 http://www.developer.nokia.com/Community/Wiki/CS001500_-_Reading_big_images_in_Qt 可以解决此问题;

使用:

    QImageReader reader;
    reader.setFileName(path);
    // Read image current size
    QSize imageSize = reader.size();
    // Scale image to fit to screen
    imageSize.scale(size(), Qt::KeepAspectRatio);
    // Set wanted image size for reader
    reader.setScaledSize(imageSize);
    // Read image
    QImage image = reader.read();
    // Make QPixmap (if needed)
    m_pictureImg = QPixmap::fromImage(image);
来代替

m_pictureImg.load(path);





你可能感兴趣的:(Qt)