diff --git a/document_management_system/core/preview_image_provider.py b/document_management_system/core/preview_image_provider.py index 7d5109f..d5e014a 100644 --- a/document_management_system/core/preview_image_provider.py +++ b/document_management_system/core/preview_image_provider.py @@ -15,8 +15,6 @@ class PreviewImageProvider(QQuickImageProvider): - mime_database = QMimeDatabase() - def __init__(self): super().__init__(QQuickImageProvider.Image) @@ -24,8 +22,6 @@ def __init__(self): self._imageReader = QImageReader() self._imageReader.setAutoTransform(True) - print("supportedMimeTypes {}".format(self._imageReader.supportedMimeTypes())) - def requestImage(self, id, size): self._imageReader.setFileName(id) image = self._imageReader.read() @@ -33,10 +29,6 @@ def requestImage(self, id, size): @staticmethod def isMimeTypeSupported(filePath): - mime_type_name = str() - for mime_type in PreviewImageProvider.mime_database.mimeTypesForFileName(filePath): - if mime_type: - mime_type_name = mime_type.name() - break - - return mime_type_name in QImageReader().supportedMimeTypes() + imageReader = QImageReader() + imageReader.setFileName(filePath) + return imageReader.canRead()