Optional<ImageContents> maybeContents = reader.read();if (!maybeContents) { qWarning() << "Error reading image:" << reader.error().errorString(); return 1; }ImageContents contents = *maybeContents;
ImageContents contents = reader.read();if (!contents.isValid()) { qWarning() << "Error reading image:" << reader.error().errorString(); return 1; }
QImageReader reader("empty.png");auto image = reader.read();if (image.isNull()) { qWarning() << reader.errorString(); // ooops there was no error, image is really null}
ImageIo reader("file.png");auto [ok, contents] = reader.read();if (!ok) { qWarning() << ok.errorString();}/// ...