bool DefaultHandler::read(ImageContents &contents, const ReadOptions &options) { Q_UNUSED(options); QImageReader reader(device(), mimeTypeToFormat(mimeType())); int count = reader.imageCount(); if (reader.supportsOption(QImageIOHandler::Animation)) { contents.setImageCount(count); for (int i = 0; i < count; i++) { QImage image; const bool ok = reader.read(&image); if (!ok) return false; contents.setImage(image, i); } } else if (count > 0) { contents.setMipmapCount(count); for (int i = 0; i < count; i++) { QImage image; reader.jumpToImage(i); const bool ok = reader.read(&image); if (!ok) return false; contents.setImage(image, 0, i); } } else { QImage image; const bool ok = reader.read(&image); if (!ok) return false; contents.setImage(image); } return true; }