Commit e59874f5 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

CompileOutput: Activate links only on left button click

Complements a7ffd67a.

Change-Id: I3e70cf635774db3e126984dd70362aa0d3baa82a
Reviewed-by: Eike Ziller's avatarEike Ziller <eike.ziller@qt.io>
parent 119ff05c
......@@ -110,8 +110,8 @@ private:
protected:
void mouseMoveEvent(QMouseEvent *ev)
{
int line = cursorForPosition(ev->pos()).block().blockNumber();
if (m_taskids.value(line, 0))
const int line = cursorForPosition(ev->pos()).block().blockNumber();
if (m_taskids.contains(line) && m_mousePressButton == Qt::NoButton)
viewport()->setCursor(Qt::PointingHandCursor);
else
viewport()->setCursor(Qt::IBeamCursor);
......@@ -121,23 +121,27 @@ protected:
void mousePressEvent(QMouseEvent *ev)
{
m_mousePressPosition = ev->pos();
m_mousePressButton = ev->button();
QPlainTextEdit::mousePressEvent(ev);
}
void mouseReleaseEvent(QMouseEvent *ev)
{
if ((m_mousePressPosition - ev->pos()).manhattanLength() < 4) {
if ((m_mousePressPosition - ev->pos()).manhattanLength() < 4
&& m_mousePressButton == Qt::LeftButton) {
int line = cursorForPosition(ev->pos()).block().blockNumber();
if (unsigned taskid = m_taskids.value(line, 0))
TaskHub::showTaskInEditor(taskid);
}
m_mousePressButton = Qt::NoButton;
QPlainTextEdit::mouseReleaseEvent(ev);
}
private:
QHash<int, unsigned int> m_taskids; //Map blocknumber to taskId
QPoint m_mousePressPosition;
Qt::MouseButton m_mousePressButton = Qt::NoButton;
};
} // namespace Internal
......
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