summaryrefslogtreecommitdiff
path: root/src/plugins/clangcodemodel/clangutils.cpp
diff options
context:
space:
mode:
authorIvan Donchevskii <ivan.donchevskii@qt.io>2018-09-25 16:19:41 +0200
committerIvan Donchevskii <ivan.donchevskii@qt.io>2018-10-02 12:26:18 +0000
commit931ec39f64a6cdb4a4e2301b7090e5f5b63c8eef (patch)
tree740248cff1c522e26f09def5a5a7ae27189ab7e4 /src/plugins/clangcodemodel/clangutils.cpp
parent089b50f7d3570266a88c3902e58d4f371b12224d (diff)
downloadqt-creator-931ec39f64a6cdb4a4e2301b7090e5f5b63c8eef.tar.gz
Clang: Change the way completion fix-its are shown
Move the completion information to the tooltip and show fix-it icon on the right of such item. Change-Id: I7eff410384104387e547695171e4864760c07fb9 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/clangcodemodel/clangutils.cpp')
-rw-r--r--src/plugins/clangcodemodel/clangutils.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/plugins/clangcodemodel/clangutils.cpp b/src/plugins/clangcodemodel/clangutils.cpp
index 2d74d7f4ef..971c055174 100644
--- a/src/plugins/clangcodemodel/clangutils.cpp
+++ b/src/plugins/clangcodemodel/clangutils.cpp
@@ -155,8 +155,18 @@ int clangColumn(const QTextBlock &line, int cppEditorColumn)
// (2) The return value is the column in Clang which is the utf8 byte offset from the beginning
// of the line.
// Here we convert column from (1) to (2).
- // '+ 1' is for 1-based columns
- return line.text().left(cppEditorColumn).toUtf8().size() + 1;
+ // '- 1' and '+ 1' are because of 1-based columns
+ return line.text().left(cppEditorColumn - 1).toUtf8().size() + 1;
+}
+
+int cppEditorColumn(const QTextBlock &line, int clangColumn)
+{
+ // (1) clangColumn is the column in Clang which is the utf8 byte offset from the beginning
+ // of the line.
+ // (2) The return value is the actual column shown by CppEditor.
+ // Here we convert column from (1) to (2).
+ // '- 1' and '+ 1' are because of 1-based columns
+ return QString::fromUtf8(line.text().toUtf8().left(clangColumn - 1)).size() + 1;
}
::Utils::CodeModelIcon::Type iconTypeForToken(const ClangBackEnd::TokenInfoContainer &token)