diff options
author | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2018-06-15 14:33:01 +0200 |
---|---|---|
committer | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2018-06-19 09:20:53 +0000 |
commit | a91956f3009df73c897c579ffcdab2108f7e5455 (patch) | |
tree | 6410a88ed323f8a1edcff85fad8bb5a190c9e0b0 /src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp | |
parent | b6dfab804b7715eec92022805b7f5ced74400ff6 (diff) |
Utils: Move common positionInText function to Utils::Text
Change-Id: I5d74a73058ca457b0fb3f13eaf945f224d5699fb
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp')
-rw-r--r-- | src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp index 2998fba7c4..2c6608c6b8 100644 --- a/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp +++ b/src/plugins/clangcodemodel/clangeditordocumentprocessor.cpp @@ -205,20 +205,16 @@ void ClangEditorDocumentProcessor::updateCodeWarnings( } namespace { -int positionInText(QTextDocument *textDocument, - const ClangBackEnd::SourceLocationContainer &sourceLocationContainer) -{ - auto textBlock = textDocument->findBlockByNumber(int(sourceLocationContainer.line) - 1); - - return textBlock.position() + int(sourceLocationContainer.column) - 1; -} - TextEditor::BlockRange toTextEditorBlock(QTextDocument *textDocument, const ClangBackEnd::SourceRangeContainer &sourceRangeContainer) { - return TextEditor::BlockRange(positionInText(textDocument, sourceRangeContainer.start), - positionInText(textDocument, sourceRangeContainer.end)); + return TextEditor::BlockRange(::Utils::Text::positionInText(textDocument, + sourceRangeContainer.start.line, + sourceRangeContainer.start.column), + ::Utils::Text::positionInText(textDocument, + sourceRangeContainer.end.line, + sourceRangeContainer.end.column)); } QList<TextEditor::BlockRange> |