aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/resourceeditor
diff options
context:
space:
mode:
authorTobias Hunger <tobias.hunger@qt.io>2017-03-10 10:49:06 +0100
committerTobias Hunger <tobias.hunger@qt.io>2017-03-10 16:44:19 +0000
commit3c85c0057740db9c1d37b800726741cb0a77b63e (patch)
tree6b6ecfa4ccffec899c15b686417626256aa52a90 /src/plugins/resourceeditor
parentfa67aa084bb53894273a8d531fae0344771a61a7 (diff)
Resources: Register as tree manager
Change-Id: I400c1d77b23e465de7acbc517530f6c080549c5e Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/resourceeditor')
-rw-r--r--src/plugins/resourceeditor/resourceeditorplugin.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/plugins/resourceeditor/resourceeditorplugin.cpp b/src/plugins/resourceeditor/resourceeditorplugin.cpp
index 16a5a35a18..0ef8e5cb50 100644
--- a/src/plugins/resourceeditor/resourceeditorplugin.cpp
+++ b/src/plugins/resourceeditor/resourceeditorplugin.cpp
@@ -44,6 +44,7 @@
#include <projectexplorer/projectnodes.h>
#include <extensionsystem/pluginmanager.h>
+#include <utils/algorithm.h>
#include <utils/parameteraction.h>
#include <utils/qtcassert.h>
@@ -210,6 +211,19 @@ bool ResourceEditorPlugin::initialize(const QStringList &arguments, QString *err
void ResourceEditorPlugin::extensionsInitialized()
{
+ ProjectTree::registerTreeManager([](FolderNode *folder) {
+ QList<FileNode *> toReplace;
+ folder->forEachNode([&toReplace](FileNode *fn) {
+ if (fn->fileType() == FileType::Resource)
+ toReplace.append(fn);
+ });
+
+ for (FileNode *file : toReplace) {
+ FolderNode *const pn = file->parentFolderNode();
+ const Utils::FileName path = file->filePath();
+ pn->replaceSubtree(file, new ResourceTopLevelNode(path, QString(), pn));
+ }
+ });
}
void ResourceEditorPlugin::onUndo()