Editor: fix annotation tooltips for horizontally scrolled editors

Fixes: QTCREATORBUG-32658
Change-Id: I6853617e1b564d25bff1ec40735b5f1d0e79f0ae
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
David Schulz
2025-04-10 13:45:27 +02:00
parent d2d4dcfb56
commit a62460fb1c

View File

@@ -4969,7 +4969,7 @@ bool TextEditorWidget::viewportEvent(QEvent *event)
// Only handle tool tip for text cursor if mouse is within the block for the text cursor,
// and not if the mouse is e.g. in the empty space behind a short line.
if (line.isValid()) {
const QRectF blockGeometry = blockBoundingGeometry(block);
const QRectF blockGeometry = blockBoundingGeometry(block).translated(contentOffset());
const int width = block == d->m_suggestionBlock ? blockGeometry.width()
: line.naturalTextRect().right();
if (pos.x() <= blockGeometry.left() + width) {