diff --git a/src/shared/qrceditor/resourcefile.cpp b/src/shared/qrceditor/resourcefile.cpp index d6aa452cdcfac0f73d4dc76ae432fb9e2178f3ea..ae003d31532166a4845249d0f4bed79c21bee389 100644 --- a/src/shared/qrceditor/resourcefile.cpp +++ b/src/shared/qrceditor/resourcefile.cpp @@ -619,12 +619,12 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const if (!index.isValid()) return QVariant(); - void * const internalPointer = index.internalPointer(); - Node * const node = reinterpret_cast<Node *>(internalPointer); - Prefix const * const prefix = node->prefix(); - File const * const file = node->file(); + const void *internalPointer = index.internalPointer(); + const Node *node = reinterpret_cast<const Node *>(internalPointer); + const Prefix *prefix = node->prefix(); + File *file = node->file(); Q_ASSERT(prefix); - bool const isFileNode = (prefix != node); + const bool isFileNode = (prefix != node); QVariant result; @@ -654,12 +654,13 @@ QVariant ResourceModel::data(const QModelIndex &index, int role) const if (isFileNode) { // File node Q_ASSERT(file); - const QString path = m_resource_file.absolutePath(file->name); - if (iconFileExtension(path)) { - const QIcon icon(path); - if (!icon.isNull()) - result = icon; + if (file->icon.isNull()) { + const QString path = m_resource_file.absolutePath(file->name); + if (iconFileExtension(path)) + file->icon = QIcon(path); } + if (!file->icon.isNull()) + result = file->icon; } break; default: diff --git a/src/shared/qrceditor/resourcefile_p.h b/src/shared/qrceditor/resourcefile_p.h index 00d999c90c6570f21d902f63c6032d9e82a47f10..4a7d510dc48edbadb84010940661db22e189d0a0 100644 --- a/src/shared/qrceditor/resourcefile_p.h +++ b/src/shared/qrceditor/resourcefile_p.h @@ -40,6 +40,7 @@ #include <QtCore/QMap> #include <QtCore/QString> #include <QtCore/QStringList> +#include <QtGui/QIcon> #include "shared_global_p.h" @@ -89,6 +90,7 @@ struct File : public Node { bool operator != (const File &other) const { return name != other.name; } QString name; QString alias; + QIcon icon; }; class FileList : public QList<File *>