Commit db5f2f14 authored by Eike Ziller's avatar Eike Ziller
Browse files

Text editors: Do not show tool tip for empty area

The editors were showing tool tips for the last cursor position in a
line, even if the mouse was hovered over the empty space behind the

Task-number: QTCREATORBUG-9437
Change-Id: Ibe3b0140b73c3a15811eeaf50a15d75f378f37f4
Reviewed-by: default avatarDavid Schulz <>
parent 714d56a3
......@@ -2517,8 +2517,17 @@ bool BaseTextEditorWidget::viewportEvent(QEvent *event)
return true;
return true;
QTextCursor tc = cursorForPosition(pos);
QTextBlock block = tc.block();
QTextLine line = block.layout()->lineForTextPosition(tc.positionInBlock());
// 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()
&& pos.x() <= blockBoundingGeometry(block).left() + line.naturalTextRect().right()) {
return true;
return QPlainTextEdit::viewportEvent(event);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment