From 774e53659fe13fb1bbcc70b90629453a0977b1de Mon Sep 17 00:00:00 2001
From: Ariya Hidayat <ariya.hidayat@trolltech.com>
Date: Wed, 10 Dec 2008 09:28:53 +0100
Subject: [PATCH] Show pointing hand cursor when hovering a change number (e.g.
 git SHA1).

RevBy: Friedemann Kleint
---
 src/plugins/vcsbase/vcsbaseeditor.cpp | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/plugins/vcsbase/vcsbaseeditor.cpp b/src/plugins/vcsbase/vcsbaseeditor.cpp
index eb65457c109..004792b8730 100644
--- a/src/plugins/vcsbase/vcsbaseeditor.cpp
+++ b/src/plugins/vcsbase/vcsbaseeditor.cpp
@@ -214,6 +214,9 @@ void VCSBaseEditor::contextMenuEvent(QContextMenuEvent *e)
 
 void VCSBaseEditor::mouseMoveEvent(QMouseEvent *e)
 {
+    bool overrideCursor = false;
+    Qt::CursorShape cursorShape;
+
     if (m_d->m_parameters->type == LogOutput || m_d->m_parameters->type == AnnotateOutput) {
         // Link emulation behaviour for 'click on change-interaction'
         QTextCursor cursor = cursorForPosition(e->pos());
@@ -226,13 +229,18 @@ void VCSBaseEditor::mouseMoveEvent(QMouseEvent *e)
             change = changeUnderCursor(cursor);
             sel.format.setProperty(QTextFormat::UserProperty, change);
             setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>() << sel);
-            viewport()->setCursor(Qt::PointingHandCursor);
+            overrideCursor = true;
+            cursorShape = Qt::PointingHandCursor;
         }
     } else {
         setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>());
-        viewport()->setCursor(Qt::IBeamCursor);
+        overrideCursor = true;
+        cursorShape = Qt::IBeamCursor;
     }
     TextEditor::BaseTextEditor::mouseMoveEvent(e);
+
+    if (overrideCursor)
+        viewport()->setCursor(cursorShape);
 }
 
 void VCSBaseEditor::mouseReleaseEvent(QMouseEvent *e)
-- 
GitLab