Commit fb82e101 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Handle forward/backward mouse buttons for editor navigation

Task-number: QTCREATORBUG-899
Reviewed-by: kh1
parent bcd020f3
......@@ -3389,6 +3389,20 @@ void BaseTextEditor::mouseMoveEvent(QMouseEvent *e)
viewport()->setCursor(Qt::IBeamCursor);
}
static bool handleForwardBackwardMouseButtons(QMouseEvent *e)
{
if (e->button() == Qt::XButton1) {
Core::EditorManager::instance()->goBackInNavigationHistory();
return true;
}
if (e->button() == Qt::XButton2) {
Core::EditorManager::instance()->goForwardInNavigationHistory();
return true;
}
return false;
}
void BaseTextEditor::mousePressEvent(QMouseEvent *e)
{
if (e->button() == Qt::LeftButton) {
......@@ -3405,6 +3419,12 @@ void BaseTextEditor::mousePressEvent(QMouseEvent *e)
if (d->m_currentLink.isValid())
d->m_linkPressed = true;
}
#ifdef Q_OS_LINUX
if (handleForwardBackwardMouseButtons(e))
return;
#endif
QPlainTextEdit::mousePressEvent(e);
}
......@@ -3423,6 +3443,11 @@ void BaseTextEditor::mouseReleaseEvent(QMouseEvent *e)
}
}
#ifndef Q_OS_LINUX
if (handleForwardBackwardMouseButtons(e))
return;
#endif
QPlainTextEdit::mouseReleaseEvent(e);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment