From 9dc75d25d45a52a473beec9d6024814532678f2c Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 6 Apr 2011 13:59:06 +0200 Subject: [PATCH] VCS: Fix unintented showing of description in log editor. In a log editor, releasing the mouse over a chunk of text while selecting would trigger the opening of the description. Prevent that by adding a flag indicating button drag, ensuring it works only when no button is pressed. Task-number: QTCREATORBUG-4385 Reviewed-by: Leandro Melo --- src/plugins/vcsbase/vcsbaseeditor.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp index add1da01cfb..5b1dccd666b 100644 --- a/src/plugins/vcsbase/vcsbaseeditor.cpp +++ b/src/plugins/vcsbase/vcsbaseeditor.cpp @@ -215,6 +215,7 @@ struct VCSBaseEditorWidgetPrivate TextEditor::BaseTextEditor *m_editor; QWidget *m_configurationWidget; bool m_revertChunkEnabled; + bool m_mouseDragging; }; VCSBaseEditorWidgetPrivate::VCSBaseEditorWidgetPrivate(const VCSBaseEditorParameters *type) : @@ -225,7 +226,8 @@ VCSBaseEditorWidgetPrivate::VCSBaseEditorWidgetPrivate(const VCSBaseEditorParame m_fileLogAnnotateEnabled(false), m_editor(0), m_configurationWidget(0), - m_revertChunkEnabled(false) + m_revertChunkEnabled(false), + m_mouseDragging(false) { } @@ -569,6 +571,12 @@ void VCSBaseEditorWidget::contextMenuEvent(QContextMenuEvent *e) void VCSBaseEditorWidget::mouseMoveEvent(QMouseEvent *e) { + if (e->buttons()) { + d->m_mouseDragging = true; + TextEditor::BaseTextEditorWidget::mouseMoveEvent(e); + return; + } + bool overrideCursor = false; Qt::CursorShape cursorShape; @@ -599,7 +607,9 @@ void VCSBaseEditorWidget::mouseMoveEvent(QMouseEvent *e) void VCSBaseEditorWidget::mouseReleaseEvent(QMouseEvent *e) { - if (d->m_parameters->type == LogOutput || d->m_parameters->type == AnnotateOutput) { + const bool wasDragging = d->m_mouseDragging; + d->m_mouseDragging = false; + if (!wasDragging && (d->m_parameters->type == LogOutput || d->m_parameters->type == AnnotateOutput)) { if (e->button() == Qt::LeftButton &&!(e->modifiers() & Qt::ShiftModifier)) { QTextCursor cursor = cursorForPosition(e->pos()); d->m_currentChange = changeUnderCursor(cursor);