aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2016-11-17 09:37:32 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2016-11-17 13:05:14 +0000
commit77c3cbd4f0844f99dfa015778ab7d53da792a985 (patch)
tree42f958e1227749d3f968db1bb58e0c39f0efcf08
parent0334438b400d81e28bd5bc8730b06cbaf97003b3 (diff)
Fix updating ui resources after creating new form
Before we have tried to update resources, however it was done too early and ui file, which has been created, was not inserted to any project yet. We were connected to ProjectTree::filesAdded signal and apparently whenever it is sent the added ui file is still not inserted to the project, thought the signal informs about that fact. Now we connect to every project's fileListChanged() signal instead. Task-number: QTCREATORBUG-15560 Change-Id: I11883a0d87fdc7c46897cef68466c1038dbaefb8 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
-rw-r--r--src/plugins/designer/resourcehandler.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/designer/resourcehandler.cpp b/src/plugins/designer/resourcehandler.cpp
index 8f8d791969..01c6ee6371 100644
--- a/src/plugins/designer/resourcehandler.cpp
+++ b/src/plugins/designer/resourcehandler.cpp
@@ -30,7 +30,6 @@
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/nodesvisitor.h>
#include <projectexplorer/project.h>
-#include <projectexplorer/projecttree.h>
#include <projectexplorer/session.h>
#include <resourceeditor/resourcenode.h>
@@ -88,12 +87,16 @@ void ResourceHandler::ensureInitialized()
return;
m_initialized = true;
- ProjectTree *tree = ProjectTree::instance();
- connect(tree, &ProjectTree::filesAdded, this, &ResourceHandler::updateResources);
- connect(tree, &ProjectTree::filesRemoved, this, &ResourceHandler::updateResources);
- connect(tree, &ProjectTree::foldersAdded, this, &ResourceHandler::updateResources);
- connect(tree, &ProjectTree::foldersRemoved, this, &ResourceHandler::updateResources);
+ auto connector = [this](Project *p) {
+ connect(p, &Project::fileListChanged, this, &ResourceHandler::updateResources);
+ };
+
+ foreach (Project *p, SessionManager::projects())
+ connector(p);
+
+ connect(SessionManager::instance(), &SessionManager::projectAdded, this, connector);
+
m_originalUiQrcPaths = m_form->activeResourceFilePaths();
if (Designer::Constants::Internal::debug)
qDebug() << "ResourceHandler::ensureInitialized() origPaths=" << m_originalUiQrcPaths;