diff --git a/src/plugins/clangcodemodel/clangdcompletion.cpp b/src/plugins/clangcodemodel/clangdcompletion.cpp index 5bcf6a9f26f..e37cf293deb 100644 --- a/src/plugins/clangcodemodel/clangdcompletion.cpp +++ b/src/plugins/clangcodemodel/clangdcompletion.cpp @@ -608,7 +608,7 @@ QList ClangdCompletionAssistProcessor::generateCo return itemGenerator(items); const QString content = doc->toPlainText(); const bool requiresSignal = CppModelManager::instance()->getSignalSlotType( - filePath().toString(), content.toUtf8(), pos) + filePath(), content.toUtf8(), pos) == SignalSlotType::NewStyleSignal; if (requiresSignal) return itemGenerator(Utils::filtered(items, criterion)); diff --git a/src/plugins/cppeditor/cppeditorwidget.cpp b/src/plugins/cppeditor/cppeditorwidget.cpp index 428d680a398..15a0695d3c2 100644 --- a/src/plugins/cppeditor/cppeditorwidget.cpp +++ b/src/plugins/cppeditor/cppeditorwidget.cpp @@ -1165,9 +1165,7 @@ bool CppEditorWidget::isOldStyleSignalOrSlot() const const QString content = textDocument()->plainText(); return CppEditor::CppModelManager::instance() - ->getSignalSlotType(textDocument()->filePath().toString(), - content.toUtf8(), - tc.position()) + ->getSignalSlotType(textDocument()->filePath(), content.toUtf8(), tc.position()) == CppEditor::SignalSlotType::OldStyleSignal; } diff --git a/src/plugins/cppeditor/cppmodelmanager.cpp b/src/plugins/cppeditor/cppmodelmanager.cpp index b71535f9e6b..a53c04ee681 100644 --- a/src/plugins/cppeditor/cppmodelmanager.cpp +++ b/src/plugins/cppeditor/cppmodelmanager.cpp @@ -92,6 +92,7 @@ static const bool DumpProjectInfo = qgetenv("QTC_DUMP_PROJECT_INFO") == "1"; using namespace CPlusPlus; using namespace ProjectExplorer; +using namespace Utils; #ifdef QTCREATOR_WITH_DUMP_AST @@ -357,7 +358,7 @@ int argumentPositionOf(const AST *last, const CallAST *callAst) return 0; } -SignalSlotType CppModelManager::getSignalSlotType(const QString &filePath, +SignalSlotType CppModelManager::getSignalSlotType(const FilePath &filePath, const QByteArray &content, int position) const { @@ -371,8 +372,7 @@ SignalSlotType CppModelManager::getSignalSlotType(const QString &filePath, fixedContent.insert(position, 'x'); const Snapshot snapshot = this->snapshot(); - const Document::Ptr document = snapshot.preprocessedDocument(fixedContent, - Utils::FilePath::fromString(filePath)); + const Document::Ptr document = snapshot.preprocessedDocument(fixedContent, filePath); document->check(); QTextDocument textDocument(QString::fromUtf8(fixedContent)); QTextCursor cursor(&textDocument); diff --git a/src/plugins/cppeditor/cppmodelmanager.h b/src/plugins/cppeditor/cppmodelmanager.h index 2572c2398a0..32f5db07170 100644 --- a/src/plugins/cppeditor/cppmodelmanager.h +++ b/src/plugins/cppeditor/cppmodelmanager.h @@ -166,7 +166,7 @@ public: QList references(CPlusPlus::Symbol *symbol, const CPlusPlus::LookupContext &context); - SignalSlotType getSignalSlotType(const QString &filePath, + SignalSlotType getSignalSlotType(const Utils::FilePath &filePath, const QByteArray &content, int position) const;