diff options
author | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2018-02-07 15:12:57 +0100 |
---|---|---|
committer | Eirik Aavitsland <eirik.aavitsland@qt.io> | 2018-02-13 09:07:54 +0000 |
commit | 25a2270e42192affe5a14582f29ae3e861c93e15 (patch) | |
tree | ac5659c9555496c8daa8e98a323034b0495c791b /src/quick/scenegraph | |
parent | 22d43f74e264626d0c28654c42c91839f9de45b5 (diff) |
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 <simon.hausmann@qt.io>
Diffstat (limited to 'src/quick/scenegraph')
-rw-r--r-- | src/quick/scenegraph/util/qsgtexturereader.cpp | 6 | ||||
-rw-r--r-- | src/quick/scenegraph/util/qsgtexturereader_p.h | 2 |
2 files changed, 8 insertions, 0 deletions
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<QByteArray> 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<QByteArray> supportedFileFormats(); + private: bool init(); QIODevice *m_device = nullptr; |