forked from qt-creator/qt-creator
TextEditor: Emit markTooltipRequested only once per line
...otherwise the same tooltip will be created over and over again, leading to a "moving tooltip widget". Change-Id: I1704bc34c458ebe1aec664d5295418ab1d2b5082 Reviewed-by: Alessandro Portale <alessandro.portale@theqtcompany.com>
This commit is contained in:
@@ -370,6 +370,7 @@ public:
|
||||
int extraAreaSelectionAnchorBlockNumber;
|
||||
int extraAreaToggleMarkBlockNumber;
|
||||
int extraAreaHighlightFoldedBlockNumber;
|
||||
int extraAreaPreviousMarkTooltipRequestedLine;
|
||||
|
||||
TextEditorOverlay *m_overlay;
|
||||
TextEditorOverlay *m_snippetOverlay;
|
||||
@@ -489,6 +490,7 @@ TextEditorWidgetPrivate::TextEditorWidgetPrivate(TextEditorWidget *parent)
|
||||
extraAreaSelectionAnchorBlockNumber(-1),
|
||||
extraAreaToggleMarkBlockNumber(-1),
|
||||
extraAreaHighlightFoldedBlockNumber(-1),
|
||||
extraAreaPreviousMarkTooltipRequestedLine(-1),
|
||||
m_overlay(0),
|
||||
m_snippetOverlay(0),
|
||||
m_searchResultOverlay(0),
|
||||
@@ -5078,6 +5080,8 @@ void TextEditorWidget::showDefaultContextMenu(QContextMenuEvent *e, Id menuConte
|
||||
|
||||
void TextEditorWidget::extraAreaLeaveEvent(QEvent *)
|
||||
{
|
||||
d->extraAreaPreviousMarkTooltipRequestedLine = -1;
|
||||
|
||||
// fake missing mouse move event from Qt
|
||||
QMouseEvent me(QEvent::MouseMove, QPoint(-1, -1), Qt::NoButton, 0, 0);
|
||||
extraAreaMouseEvent(&me);
|
||||
@@ -5136,7 +5140,9 @@ void TextEditorWidget::extraAreaMouseEvent(QMouseEvent *e)
|
||||
if (inMarkArea) {
|
||||
//Find line by cursor position
|
||||
int line = cursor.blockNumber() + 1;
|
||||
if (d->extraAreaPreviousMarkTooltipRequestedLine != line)
|
||||
emit markTooltipRequested(this, mapToGlobal(e->pos()), line);
|
||||
d->extraAreaPreviousMarkTooltipRequestedLine = line;
|
||||
}
|
||||
|
||||
if (e->buttons() & Qt::LeftButton && !d->m_markDragStart.isNull()) {
|
||||
|
Reference in New Issue
Block a user