forked from qt-creator/qt-creator
Editor: improve open link via mouse press
It improve in the situations where the mouse move slightly between press and release event, this should be mostly notable for trackpad users. Fixes: QTCREATORBUG-26595 Change-Id: I36ef7d23c80c09b9248abd8313c040993ece92a4 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -5296,7 +5296,17 @@ void TextEditorWidgetPrivate::clearVisibleFoldedBlock()
|
||||
void TextEditorWidget::mouseMoveEvent(QMouseEvent *e)
|
||||
{
|
||||
d->requestUpdateLink(e);
|
||||
d->m_linkPressed = false;
|
||||
|
||||
bool onLink = false;
|
||||
if (d->m_linkPressed && d->m_currentLink.hasValidTarget()) {
|
||||
const int eventCursorPosition = cursorForPosition(e->pos()).position();
|
||||
if (eventCursorPosition < d->m_currentLink.linkTextStart
|
||||
|| eventCursorPosition > d->m_currentLink.linkTextEnd) {
|
||||
d->m_linkPressed = false;
|
||||
} else {
|
||||
onLink = true;
|
||||
}
|
||||
}
|
||||
|
||||
static Utils::optional<MultiTextCursor> startMouseMoveCursor;
|
||||
if (e->buttons() == Qt::LeftButton && e->modifiers() & Qt::AltModifier) {
|
||||
@@ -5357,7 +5367,8 @@ void TextEditorWidget::mouseMoveEvent(QMouseEvent *e)
|
||||
d->m_mouseOnFoldedMarker = false;
|
||||
viewport()->setCursor(Qt::IBeamCursor);
|
||||
}
|
||||
} else {
|
||||
} else if (!onLink || e->buttons() != Qt::LeftButton
|
||||
|| e->modifiers() != Qt::ControlModifier) {
|
||||
QPlainTextEdit::mouseMoveEvent(e);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user