From 25a2270e42192affe5a14582f29ae3e861c93e15 Mon Sep 17 00:00:00 2001 From: Eirik Aavitsland Date: Wed, 7 Feb 2018 15:12:57 +0100 Subject: Fix: Make Image element support detection of suitable file extension If the source is a non-existent local file or resource, then instead of giving up directly, check if there exists a file/resource with the same name and a known supported image/texture file extension (suffix). [ChangeLog][QtQuick][Image] Support detection of suitable file extension Task-number: QTBUG-66127 Change-Id: I4c0edb639017e8707eed8e532ba55d29917751cb Reviewed-by: Simon Hausmann --- src/quick/scenegraph/util/qsgtexturereader.cpp | 6 ++++++ src/quick/scenegraph/util/qsgtexturereader_p.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'src/quick/scenegraph') diff --git a/src/quick/scenegraph/util/qsgtexturereader.cpp b/src/quick/scenegraph/util/qsgtexturereader.cpp index 168afb9e56..eb0caa59e4 100644 --- a/src/quick/scenegraph/util/qsgtexturereader.cpp +++ b/src/quick/scenegraph/util/qsgtexturereader.cpp @@ -92,6 +92,12 @@ bool QSGTextureReader::isTexture() #endif } +QList QSGTextureReader::supportedFileFormats() +{ + // Hardcoded for now + return {QByteArrayLiteral("pkm"), QByteArrayLiteral("ktx")}; +} + bool QSGTextureReader::init() { if (!m_device) diff --git a/src/quick/scenegraph/util/qsgtexturereader_p.h b/src/quick/scenegraph/util/qsgtexturereader_p.h index 8251e4c696..1d874f840c 100644 --- a/src/quick/scenegraph/util/qsgtexturereader_p.h +++ b/src/quick/scenegraph/util/qsgtexturereader_p.h @@ -71,6 +71,8 @@ public: // TBD access function to params // TBD ask for identified fmt + static QList supportedFileFormats(); + private: bool init(); QIODevice *m_device = nullptr; -- cgit v1.2.3