CppEditor: Avoid a FilePath <-> QString roundtrip

Change-Id: Ia7860e04090aee8b7fae18cdc5f2d85880f29d69
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2022-08-10 11:13:32 +02:00
parent 0197a62fcf
commit 8953d68f9a
4 changed files with 6 additions and 8 deletions

View File

@@ -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);