QmlDesigner: Fix shader asset icon in assets view

Fixes: QDS-9297
Change-Id: Ib81e1e12476b436dbb04984bf6f6567a88a44f63
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
Miikka Heikkinen
2023-02-28 17:49:18 +02:00
parent 288dc3f3fa
commit 8e8cb6aa3d
2 changed files with 18 additions and 5 deletions

View File

@@ -35,6 +35,12 @@ const QStringList &Asset::supportedFragmentShaderSuffixes()
return retList; return retList;
} }
const QStringList &Asset::supportedVertexShaderSuffixes()
{
static const QStringList retList {"*.vert", "*.glsl", "*.glslv", "*.vsh"};
return retList;
}
const QStringList &Asset::supportedShaderSuffixes() const QStringList &Asset::supportedShaderSuffixes()
{ {
static const QStringList retList {"*.frag", "*.vert", static const QStringList retList {"*.frag", "*.vert",
@@ -114,9 +120,14 @@ bool Asset::isFragmentShader() const
return m_type == Asset::Type::FragmentShader; return m_type == Asset::Type::FragmentShader;
} }
bool Asset::isVertexShader() const
{
return m_type == Asset::Type::VertexShader;
}
bool Asset::isShader() const bool Asset::isShader() const
{ {
return m_type == Asset::Type::Shader; return isFragmentShader() || isVertexShader();
} }
bool Asset::isFont() const bool Asset::isFont() const
@@ -178,8 +189,8 @@ void Asset::resolveType()
m_type = Asset::Type::Image; m_type = Asset::Type::Image;
else if (supportedFragmentShaderSuffixes().contains(m_suffix)) else if (supportedFragmentShaderSuffixes().contains(m_suffix))
m_type = Asset::Type::FragmentShader; m_type = Asset::Type::FragmentShader;
else if (supportedShaderSuffixes().contains(m_suffix)) else if (supportedVertexShaderSuffixes().contains(m_suffix))
m_type = Asset::Type::Shader; m_type = Asset::Type::VertexShader;
else if (supportedFontSuffixes().contains(m_suffix)) else if (supportedFontSuffixes().contains(m_suffix))
m_type = Asset::Type::Font; m_type = Asset::Type::Font;
else if (supportedAudioSuffixes().contains(m_suffix)) else if (supportedAudioSuffixes().contains(m_suffix))

View File

@@ -14,17 +14,18 @@ public:
Image, Image,
MissingImage, MissingImage,
FragmentShader, FragmentShader,
VertexShader,
Font, Font,
Audio, Audio,
Video, Video,
Texture3D, Texture3D,
Effect, Effect };
Shader };
Asset(const QString &filePath); Asset(const QString &filePath);
static const QStringList &supportedImageSuffixes(); static const QStringList &supportedImageSuffixes();
static const QStringList &supportedFragmentShaderSuffixes(); static const QStringList &supportedFragmentShaderSuffixes();
static const QStringList &supportedVertexShaderSuffixes();
static const QStringList &supportedShaderSuffixes(); static const QStringList &supportedShaderSuffixes();
static const QStringList &supportedFontSuffixes(); static const QStringList &supportedFontSuffixes();
static const QStringList &supportedAudioSuffixes(); static const QStringList &supportedAudioSuffixes();
@@ -41,6 +42,7 @@ public:
Type type() const; Type type() const;
bool isImage() const; bool isImage() const;
bool isFragmentShader() const; bool isFragmentShader() const;
bool isVertexShader() const;
bool isShader() const; bool isShader() const;
bool isFont() const; bool isFont() const;
bool isAudio() const; bool isAudio() const;