summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppoverviewmodel.cpp
diff options
context:
space:
mode:
authorIvan Donchevskii <ivan.donchevskii@qt.io>2018-06-01 09:18:45 +0200
committerIvan Donchevskii <ivan.donchevskii@qt.io>2018-06-04 08:43:44 +0000
commitb0c01193457ef931577a7b4d850c22826c91ac01 (patch)
treea3fbefb8f807d8bccdd16563541d1b33d251c3ef /src/plugins/cpptools/cppoverviewmodel.cpp
parent92530fd05dfe596810e90b499d399f1859bdfd56 (diff)
downloadqt-creator-b0c01193457ef931577a7b4d850c22826c91ac01.tar.gz
CppTools: Use cursor range for better outline navigation
Clang provides cursor range for each declaration in symbol outline. Use that information to search for more accurate correspondence between a cursor position in editor and an entry in symbol outline. For example skip indexes with not matching ranges to prevent pure declarations from automatically become parents of everything coming after them. Change-Id: I0ef95c26772050cd6655e830288c46118aba38bb Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'src/plugins/cpptools/cppoverviewmodel.cpp')
-rw-r--r--src/plugins/cpptools/cppoverviewmodel.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppoverviewmodel.cpp b/src/plugins/cpptools/cppoverviewmodel.cpp
index 590f2b6847..8c720b75ca 100644
--- a/src/plugins/cpptools/cppoverviewmodel.cpp
+++ b/src/plugins/cpptools/cppoverviewmodel.cpp
@@ -190,6 +190,12 @@ Utils::LineColumn OverviewModel::lineColumnFromIndex(const QModelIndex &sourceIn
return lineColumn;
}
+OverviewModel::Range OverviewModel::rangeFromIndex(const QModelIndex &sourceIndex) const
+{
+ Utils::LineColumn lineColumn = lineColumnFromIndex(sourceIndex);
+ return std::make_pair(lineColumn, lineColumn);
+}
+
void OverviewModel::buildTree(SymbolItem *root, bool isRoot)
{
if (!root)