diff --git a/src/plugins/projectexplorer/projectnodes.cpp b/src/plugins/projectexplorer/projectnodes.cpp index c4b33d74140..61dfff43d05 100644 --- a/src/plugins/projectexplorer/projectnodes.cpp +++ b/src/plugins/projectexplorer/projectnodes.cpp @@ -1094,4 +1094,28 @@ QIcon DirectoryIcon::icon() const return icon; } +ResourceFileNode::ResourceFileNode(const FilePath &filePath, const QString &qrcPath, const QString &displayName) + : FileNode(filePath, FileNode::fileTypeForFileName(filePath)) + , m_qrcPath(qrcPath) + , m_displayName(displayName) +{ +} + +QString ResourceFileNode::displayName() const +{ + return m_displayName; +} + +QString ResourceFileNode::qrcPath() const +{ + return m_qrcPath; +} + +bool ResourceFileNode::supportsAction(ProjectAction action, const Node *node) const +{ + if (action == HidePathActions) + return false; + return parentFolderNode()->supportsAction(action, node); +} + } // namespace ProjectExplorer diff --git a/src/plugins/projectexplorer/projectnodes.h b/src/plugins/projectexplorer/projectnodes.h index c5cd68a4c53..9e2e4e9474d 100644 --- a/src/plugins/projectexplorer/projectnodes.h +++ b/src/plugins/projectexplorer/projectnodes.h @@ -464,6 +464,20 @@ private: Project *m_project; }; +class PROJECTEXPLORER_EXPORT ResourceFileNode : public ProjectExplorer::FileNode +{ +public: + ResourceFileNode(const Utils::FilePath &filePath, const QString &qrcPath, const QString &displayName); + + QString displayName() const override; + QString qrcPath() const; + bool supportsAction(ProjectExplorer::ProjectAction action, const Node *node) const override; + +private: + QString m_qrcPath; + QString m_displayName; +}; + } // namespace ProjectExplorer Q_DECLARE_METATYPE(ProjectExplorer::Node *) diff --git a/src/plugins/qmlpreview/qmlpreviewfileontargetfinder.cpp b/src/plugins/qmlpreview/qmlpreviewfileontargetfinder.cpp index aebce83d5a9..f4c6e438072 100644 --- a/src/plugins/qmlpreview/qmlpreviewfileontargetfinder.cpp +++ b/src/plugins/qmlpreview/qmlpreviewfileontargetfinder.cpp @@ -33,8 +33,6 @@ #include #include -#include - #include namespace QmlPreview { @@ -52,7 +50,7 @@ ProjectExplorer::Target *QmlPreviewFileOnTargetFinder::target() const QString resourceNodePath(const ProjectExplorer::Node *node) { - if (auto resourceNode = dynamic_cast(node)) + if (auto resourceNode = dynamic_cast(node)) return ":" + resourceNode->qrcPath(); return QString(); } diff --git a/src/plugins/qtsupport/baseqtversion.cpp b/src/plugins/qtsupport/baseqtversion.cpp index 62b2927b022..c2460fd1290 100644 --- a/src/plugins/qtsupport/baseqtversion.cpp +++ b/src/plugins/qtsupport/baseqtversion.cpp @@ -1693,7 +1693,7 @@ void QtVersion::populateQmlFileFinder(FileInProjectFinder *finder, const Target if (startupProject) { if (ProjectNode *rootNode = startupProject->rootProjectNode()) { rootNode->forEachNode([&](FileNode *node) { - if (auto resourceNode = dynamic_cast(node)) + if (auto resourceNode = dynamic_cast(node)) finder->addMappedPath(node->filePath(), ":" + resourceNode->qrcPath()); }); } else { diff --git a/src/plugins/resourceeditor/resourcenode.cpp b/src/plugins/resourceeditor/resourcenode.cpp index 30070e7ec71..bc9274fa895 100644 --- a/src/plugins/resourceeditor/resourcenode.cpp +++ b/src/plugins/resourceeditor/resourcenode.cpp @@ -637,28 +637,4 @@ ResourceTopLevelNode *ResourceFolderNode::resourceNode() const return m_topLevelNode; } -ResourceFileNode::ResourceFileNode(const FilePath &filePath, const QString &qrcPath, const QString &displayName) - : FileNode(filePath, FileNode::fileTypeForFileName(filePath)) - , m_qrcPath(qrcPath) - , m_displayName(displayName) -{ -} - -QString ResourceFileNode::displayName() const -{ - return m_displayName; -} - -QString ResourceFileNode::qrcPath() const -{ - return m_qrcPath; -} - -bool ResourceFileNode::supportsAction(ProjectAction action, const Node *node) const -{ - if (action == HidePathActions) - return false; - return parentFolderNode()->supportsAction(action, node); -} - } // ResourceEditor diff --git a/src/plugins/resourceeditor/resourcenode.h b/src/plugins/resourceeditor/resourcenode.h index 03ae8039f0c..bb974cb2af5 100644 --- a/src/plugins/resourceeditor/resourcenode.h +++ b/src/plugins/resourceeditor/resourcenode.h @@ -91,18 +91,4 @@ private: QString m_lang; }; -class RESOURCE_EXPORT ResourceFileNode : public ProjectExplorer::FileNode -{ -public: - ResourceFileNode(const Utils::FilePath &filePath, const QString &qrcPath, const QString &displayName); - - QString displayName() const override; - QString qrcPath() const; - bool supportsAction(ProjectExplorer::ProjectAction action, const Node *node) const override; - -private: - QString m_qrcPath; - QString m_displayName; -}; - } // namespace ResourceEditor