fix: always detect format from content

This commit is contained in:
Gary Wang 2019-10-13 22:12:58 +08:00
parent f88af4b6c0
commit dc533e26c9
2 changed files with 5 additions and 0 deletions

View File

@ -7,3 +7,7 @@
- For windows build, win32 APIs are used. - For windows build, win32 APIs are used.
- No license file provided. - No license file provided.
- No drag-window-border-to-resize support under non-windows platforms (I use <kbd>Meta+Drag</kbd> to resize window under my x11 desktop). - No drag-window-border-to-resize support under non-windows platforms (I use <kbd>Meta+Drag</kbd> to resize window under my x11 desktop).
## License
This program released under MIT license

View File

@ -42,6 +42,7 @@ void GraphicsView::showFromUrlList(const QList<QUrl> &urlList)
showGif(filePath); showGif(filePath);
} else { } else {
QImageReader imageReader(filePath); QImageReader imageReader(filePath);
imageReader.setDecideFormatFromContent(true);
QImage::Format imageFormat = imageReader.imageFormat(); QImage::Format imageFormat = imageReader.imageFormat();
if (imageFormat == QImage::Format_Invalid) { if (imageFormat == QImage::Format_Invalid) {
showText(tr("File is not a valid image")); showText(tr("File is not a valid image"));