forked from qt-creator/qt-creator
Show pointing hand cursor when hovering a change number (e.g. git SHA1).
RevBy: Friedemann Kleint
This commit is contained in:
@@ -214,6 +214,9 @@ void VCSBaseEditor::contextMenuEvent(QContextMenuEvent *e)
|
|||||||
|
|
||||||
void VCSBaseEditor::mouseMoveEvent(QMouseEvent *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) {
|
if (m_d->m_parameters->type == LogOutput || m_d->m_parameters->type == AnnotateOutput) {
|
||||||
// Link emulation behaviour for 'click on change-interaction'
|
// Link emulation behaviour for 'click on change-interaction'
|
||||||
QTextCursor cursor = cursorForPosition(e->pos());
|
QTextCursor cursor = cursorForPosition(e->pos());
|
||||||
@@ -226,13 +229,18 @@ void VCSBaseEditor::mouseMoveEvent(QMouseEvent *e)
|
|||||||
change = changeUnderCursor(cursor);
|
change = changeUnderCursor(cursor);
|
||||||
sel.format.setProperty(QTextFormat::UserProperty, change);
|
sel.format.setProperty(QTextFormat::UserProperty, change);
|
||||||
setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>() << sel);
|
setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>() << sel);
|
||||||
viewport()->setCursor(Qt::PointingHandCursor);
|
overrideCursor = true;
|
||||||
|
cursorShape = Qt::PointingHandCursor;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>());
|
setExtraSelections(OtherSelection, QList<QTextEdit::ExtraSelection>());
|
||||||
viewport()->setCursor(Qt::IBeamCursor);
|
overrideCursor = true;
|
||||||
|
cursorShape = Qt::IBeamCursor;
|
||||||
}
|
}
|
||||||
TextEditor::BaseTextEditor::mouseMoveEvent(e);
|
TextEditor::BaseTextEditor::mouseMoveEvent(e);
|
||||||
|
|
||||||
|
if (overrideCursor)
|
||||||
|
viewport()->setCursor(cursorShape);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VCSBaseEditor::mouseReleaseEvent(QMouseEvent *e)
|
void VCSBaseEditor::mouseReleaseEvent(QMouseEvent *e)
|
||||||
|
|||||||
Reference in New Issue
Block a user