diff --git a/src/plugins/qmldesigner/components/assetslibrary/assetslibrary.qrc b/src/plugins/qmldesigner/components/assetslibrary/assetslibrary.qrc index 26b4250d0ab..fb4255cdf6f 100644 --- a/src/plugins/qmldesigner/components/assetslibrary/assetslibrary.qrc +++ b/src/plugins/qmldesigner/components/assetslibrary/assetslibrary.qrc @@ -19,5 +19,8 @@ images/assets_default_128.png images/asset_effectClass_128.png images/asset_effectExported_128.png + images/asset_ktx.png + images/asset_ktx@2x.png + images/asset_ktx_128.png diff --git a/src/plugins/qmldesigner/components/assetslibrary/assetslibraryiconprovider.cpp b/src/plugins/qmldesigner/components/assetslibrary/assetslibraryiconprovider.cpp index d3a0d0a72b9..ef331f0e0f8 100644 --- a/src/plugins/qmldesigner/components/assetslibrary/assetslibraryiconprovider.cpp +++ b/src/plugins/qmldesigner/components/assetslibrary/assetslibraryiconprovider.cpp @@ -92,8 +92,8 @@ QPair AssetsLibraryIconProvider::fetchPixmap(const QString &id, return {pixmap, size}; } else if (asset.isKtxFile()) { qint64 size = QFileInfo(id).size(); - // TODO: Return ktx specific default image once available (QDS-9140) - return {{}, size}; + QString filePath = Utils::StyleHelper::dpiSpecificImageFile(":/AssetsLibrary/images/asset_ktx.png"); + return {QPixmap{filePath}, size}; } else { QString type; if (asset.isShader()) diff --git a/src/plugins/qmldesigner/components/assetslibrary/images/asset_ktx.png b/src/plugins/qmldesigner/components/assetslibrary/images/asset_ktx.png new file mode 100644 index 00000000000..077b2f3d8d2 Binary files /dev/null and b/src/plugins/qmldesigner/components/assetslibrary/images/asset_ktx.png differ diff --git a/src/plugins/qmldesigner/components/assetslibrary/images/asset_ktx@2x.png b/src/plugins/qmldesigner/components/assetslibrary/images/asset_ktx@2x.png new file mode 100644 index 00000000000..3dca205a4f1 Binary files /dev/null and b/src/plugins/qmldesigner/components/assetslibrary/images/asset_ktx@2x.png differ diff --git a/src/plugins/qmldesigner/components/assetslibrary/images/asset_ktx_128.png b/src/plugins/qmldesigner/components/assetslibrary/images/asset_ktx_128.png new file mode 100644 index 00000000000..ed897ae4147 Binary files /dev/null and b/src/plugins/qmldesigner/components/assetslibrary/images/asset_ktx_128.png differ diff --git a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp index 8973dc47ae6..5eb685ff32a 100644 --- a/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp +++ b/src/plugins/qmldesigner/components/materialbrowser/materialbrowserwidget.cpp @@ -124,6 +124,8 @@ bool MaterialBrowserWidget::eventFilter(QObject *obj, QEvent *event) const QString suffix = iconPath.split('.').last().toLower(); if (suffix == "hdr") pixmap = HdrImage{iconPath}.toPixmap(); + else if (suffix == "ktx") + pixmap = Utils::StyleHelper::dpiSpecificImageFile(":/textureeditor/images/texture_ktx.png"); else pixmap = Utils::StyleHelper::dpiSpecificImageFile(iconPath); if (pixmap.isNull()) diff --git a/src/plugins/qmldesigner/components/propertyeditor/assetimageprovider.cpp b/src/plugins/qmldesigner/components/propertyeditor/assetimageprovider.cpp index ad60079c5aa..5ecf048ab15 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/assetimageprovider.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/assetimageprovider.cpp @@ -24,6 +24,26 @@ QQuickImageResponse *AssetImageProvider::requestImageResponse(const QString &id, if (id.endsWith(".builtin")) return m_imageCacheProvider.requestImageResponse("#" + id.split('.').first(), {}); + if (id.endsWith(".ktx")) { + auto response = std::make_unique(m_imageCacheProvider.defaultImage()); + + QMetaObject::invokeMethod( + response.get(), + [response = QPointer(response.get()), requestedSize] { + QImage ktxImage; + ktxImage.load(Utils::StyleHelper::dpiSpecificImageFile(":/textureeditor/images/texture_ktx.png")); + if (ktxImage.isNull()) + ktxImage = response->image(); + if (requestedSize.isValid()) + response->setImage(ktxImage.scaled(requestedSize, Qt::KeepAspectRatio)); + else + response->setImage(ktxImage); + }, + Qt::QueuedConnection); + + return response.release(); + } + return m_imageCacheProvider.requestImageResponse(id, requestedSize); } diff --git a/src/plugins/qmldesigner/components/textureeditor/images/texture_ktx.png b/src/plugins/qmldesigner/components/textureeditor/images/texture_ktx.png new file mode 100644 index 00000000000..cad32f6114f Binary files /dev/null and b/src/plugins/qmldesigner/components/textureeditor/images/texture_ktx.png differ diff --git a/src/plugins/qmldesigner/components/textureeditor/images/texture_ktx@2x.png b/src/plugins/qmldesigner/components/textureeditor/images/texture_ktx@2x.png new file mode 100644 index 00000000000..015ae045d75 Binary files /dev/null and b/src/plugins/qmldesigner/components/textureeditor/images/texture_ktx@2x.png differ diff --git a/src/plugins/qmldesigner/components/textureeditor/textureeditor.qrc b/src/plugins/qmldesigner/components/textureeditor/textureeditor.qrc index 680fe7d82b0..cb43ec1aa98 100644 --- a/src/plugins/qmldesigner/components/textureeditor/textureeditor.qrc +++ b/src/plugins/qmldesigner/components/textureeditor/textureeditor.qrc @@ -2,5 +2,7 @@ images/texture_default.png images/texture_default@2x.png + images/texture_ktx.png + images/texture_ktx@2x.png