diff options
Diffstat (limited to 'src/plugins/designer/qtcreatorintegration.cpp')
-rw-r--r-- | src/plugins/designer/qtcreatorintegration.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/plugins/designer/qtcreatorintegration.cpp b/src/plugins/designer/qtcreatorintegration.cpp index db96523c360..010ab85a82b 100644 --- a/src/plugins/designer/qtcreatorintegration.cpp +++ b/src/plugins/designer/qtcreatorintegration.cpp @@ -1,10 +1,13 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +#include "qtcreatorintegration.h" + +#include "designerconstants.h" #include "designertr.h" -#include "formeditorw.h" +#include "formeditor.h" #include "formwindoweditor.h" -#include "qtcreatorintegration.h" + #include <widgethost.h> #include <designer/cpp/formclasswizardpage.h> @@ -16,20 +19,24 @@ #include <cppeditor/cppworkingcopy.h> #include <cppeditor/insertionpointlocator.h> #include <cppeditor/symbolfinder.h> + #include <cplusplus/LookupContext.h> #include <cplusplus/Overview.h> + #include <coreplugin/icore.h> #include <coreplugin/editormanager/editormanager.h> #include <coreplugin/messagemanager.h> -#include <texteditor/texteditor.h> -#include <texteditor/textdocument.h> + #include <projectexplorer/buildsystem.h> #include <projectexplorer/extracompiler.h> #include <projectexplorer/projectexplorer.h> +#include <projectexplorer/projectmanager.h> #include <projectexplorer/projecttree.h> -#include <projectexplorer/session.h> #include <projectexplorer/target.h> +#include <texteditor/texteditor.h> +#include <texteditor/textdocument.h> + #include <utils/algorithm.h> #include <utils/mimeutils.h> #include <utils/qtcassert.h> @@ -152,14 +159,14 @@ void QtCreatorIntegration::slotDesignerHelpRequested(const QString &manual, cons void QtCreatorIntegration::updateSelection() { - if (SharedTools::WidgetHost *host = FormEditorW::activeWidgetHost()) + if (SharedTools::WidgetHost *host = activeWidgetHost()) host->updateFormWindowSelectionHandles(true); QDesignerIntegration::updateSelection(); } QWidget *QtCreatorIntegration::containerWindow(QWidget * /*widget*/) const { - if (SharedTools::WidgetHost *host = FormEditorW::activeWidgetHost()) + if (SharedTools::WidgetHost *host = activeWidgetHost()) return host->integrationContainer(); return nullptr; } @@ -431,7 +438,7 @@ void QtCreatorIntegration::slotNavigateToSlot(const QString &objectName, const Q { QString errorMessage; if (!navigateToSlot(objectName, signalSignature, parameterNames, &errorMessage) && !errorMessage.isEmpty()) - QMessageBox::warning(FormEditorW::designerEditor()->topLevel(), Tr::tr("Error finding/adding a slot."), errorMessage); + QMessageBox::warning(designerEditor()->topLevel(), Tr::tr("Error finding/adding a slot."), errorMessage); } // Build name of the class as generated by uic, insert Ui namespace @@ -452,8 +459,8 @@ static Document::Ptr getParsedDocument(const FilePath &filePath, Snapshot &snapshot) { QByteArray src; - if (workingCopy.contains(filePath)) { - src = workingCopy.source(filePath); + if (const auto source = workingCopy.source(filePath)) { + src = *source; } else { Utils::FileReader reader; if (reader.fetch(filePath)) // ### FIXME error reporting @@ -476,7 +483,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName, { using DocumentMap = QMap<int, Document::Ptr>; - const Utils::FilePath currentUiFile = FormEditorW::activeEditor()->document()->filePath(); + const Utils::FilePath currentUiFile = activeEditor()->document()->filePath(); #if 0 return Designer::Internal::navigateToSlot(currentUiFile.toString(), objectName, signalSignature, parameterNames, errorMessage); @@ -493,10 +500,10 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName, // Retrieve code model snapshot restricted to project of ui file or the working copy. Snapshot docTable = CppEditor::CppModelManager::instance()->snapshot(); Snapshot newDocTable; - const Project *uiProject = SessionManager::projectForFile(currentUiFile); + const Project *uiProject = ProjectManager::projectForFile(currentUiFile); if (uiProject) { for (Snapshot::const_iterator i = docTable.begin(), ei = docTable.end(); i != ei; ++i) { - const Project *project = SessionManager::projectForFile(i.key()); + const Project *project = ProjectManager::projectForFile(i.key()); if (project == uiProject) newDocTable.insert(i.value()); } @@ -529,7 +536,7 @@ bool QtCreatorIntegration::navigateToSlot(const QString &objectName, return false; } - QDesignerFormWindowInterface *fwi = FormEditorW::activeWidgetHost()->formWindow(); + QDesignerFormWindowInterface *fwi = activeWidgetHost()->formWindow(); QString uiClass; const Class *cl = nullptr; @@ -639,7 +646,7 @@ void QtCreatorIntegration::handleSymbolRenameStage1( return; // Get ExtraCompiler. - const Project * const project = SessionManager::projectForFile(uiFile); + const Project * const project = ProjectManager::projectForFile(uiFile); if (!project) { return reportRenamingError(oldName, Designer::Tr::tr("File \"%1\" not found in project.") .arg(uiFile.toUserOutput())); |