QmlDesigner: Fix NavigatorView context help

Remove line increment in jumpToModelNode code as it erroneously puts the
cursor in the text editor to the next line of a selected item.

As the NavigatorView and others currently using the context help
function of the text editor, which internally depends on the cursor
position, and hence on the assumption that when selecting an item via
any view the cursor is placed on the item an not inside the item,
pushing the cursor down by one line breaks that assumption. As a result
the context help searches for nothing or a property (e.g. id) and not
the selected node.

Task-number: QDS-13252
Change-Id: I00810a0ff8ddd49177ebf18e3eea7b6b05cc0af3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Henning Gruendl
2024-07-23 12:47:33 +02:00
committed by Henning Gründl
parent 74d7c84c8d
commit 52a5cfdb30

View File

@@ -115,7 +115,7 @@ void TextEditorWidget::jumpToModelNode(const ModelNode &modelNode)
if (nodeOffset > 0) { if (nodeOffset > 0) {
int line, column; int line, column;
m_textEditor->editorWidget()->convertPosition(nodeOffset, &line, &column); m_textEditor->editorWidget()->convertPosition(nodeOffset, &line, &column);
m_textEditor->editorWidget()->gotoLine(line + 1, column); m_textEditor->editorWidget()->gotoLine(line, column);
highlightToModelNode(modelNode); highlightToModelNode(modelNode);
} }