Utils: Don't start at end of Markdown document

QTextEdit::show will try to scroll so that the cursor is visible.
By default the cursor is at the end of the document after
::setMarkdown().

To counteract we reset the cursor to the top.

Change-Id: I0e25878f32775de715fd4789d45274492b2981fe
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Marcus Tillmanns
2024-12-04 09:27:30 +01:00
parent 4a041f8a74
commit 8a708b437a

View File

@@ -413,6 +413,9 @@ void MarkdownBrowser::setMarkdown(const QString &markdown)
{
document()->setMarkdown(markdown);
postProcessDocument(true);
// Reset cursor to start of the document, so that "show" does not
// scroll to the end of the document.
setTextCursor(QTextCursor(document()));
}
void MarkdownBrowser::postProcessDocument(bool firstTime) const