Load QIcons once for asset tree and share with each Asset Tree Item to avoid file loads for every asset and improve start up time (#6485)
Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>
This commit is contained in:
@@ -16,9 +16,12 @@ namespace AssetProcessor
|
||||
|
||||
AssetTreeModel::AssetTreeModel(AZStd::shared_ptr<AzToolsFramework::AssetDatabase::AssetDatabaseConnection> sharedDbConnection, QObject *parent) :
|
||||
QAbstractItemModel(parent),
|
||||
m_sharedDbConnection(sharedDbConnection),
|
||||
m_errorIcon(QStringLiteral(":/stylesheet/img/logging/error.svg"))
|
||||
m_sharedDbConnection(sharedDbConnection)
|
||||
, m_errorIcon(QStringLiteral(":/stylesheet/img/logging/error.svg"))
|
||||
, m_folderIcon(QIcon(QStringLiteral(":/Gallery/Asset_Folder.svg")))
|
||||
, m_fileIcon(QIcon(QStringLiteral(":/Gallery/Asset_File.svg")))
|
||||
{
|
||||
m_folderIcon.addFile(QStringLiteral(":/Gallery/Asset_Folder.svg"), QSize(), QIcon::Selected);
|
||||
ApplicationManagerNotifications::Bus::Handler::BusConnect();
|
||||
AzToolsFramework::AssetDatabase::AssetDatabaseNotificationBus::Handler::BusConnect();
|
||||
}
|
||||
@@ -40,7 +43,7 @@ namespace AssetProcessor
|
||||
void AssetTreeModel::Reset()
|
||||
{
|
||||
beginResetModel();
|
||||
m_root.reset(new AssetTreeItem(AZStd::make_shared<AssetTreeItemData>("", "", true, AZ::Uuid::CreateNull()), m_errorIcon));
|
||||
m_root.reset(new AssetTreeItem(AZStd::make_shared<AssetTreeItemData>("", "", true, AZ::Uuid::CreateNull()), m_errorIcon, m_folderIcon, m_fileIcon));
|
||||
|
||||
ResetModel();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user