From e27279d28c90e950ab0367eb4aa045302df25459 Mon Sep 17 00:00:00 2001 From: "Martin T. H. Sandsmark" Date: Sat, 2 Nov 2013 20:02:46 +0100 Subject: [PATCH] Allow control click to open URLs When you hold down control, show a hand cursor and allow single clicks when over links. --- src/TerminalDisplay.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp index 942e18fa..6f6b98d9 100644 --- a/src/TerminalDisplay.cpp +++ b/src/TerminalDisplay.cpp @@ -1912,7 +1912,7 @@ void TerminalDisplay::mousePressEvent(QMouseEvent* ev) emit mouseSignal(0, charColumn + 1, charLine + 1 + _scrollBar->value() - _scrollBar->maximum() , 0); } - if (_underlineLinks && _openLinksByDirectClick) { + if (_underlineLinks && (_openLinksByDirectClick || (ev->modifiers() & Qt::ControlModifier))) { Filter::HotSpot* spot = _filterChain->hotSpotAt(charLine, charColumn); if (spot && spot->type() == Filter::HotSpot::Link) { QObject action; @@ -1981,13 +1981,13 @@ void TerminalDisplay::mouseMoveEvent(QMouseEvent* ev) _mouseOverHotspotArea |= r; } - if (_openLinksByDirectClick && (cursor().shape() != Qt::PointingHandCursor)) + if ((_openLinksByDirectClick || (ev->modifiers() & Qt::ControlModifier)) && (cursor().shape() != Qt::PointingHandCursor)) setCursor(Qt::PointingHandCursor); update(_mouseOverHotspotArea | previousHotspotArea); } } else if (!_mouseOverHotspotArea.isEmpty()) { - if (_underlineLinks && _openLinksByDirectClick) + if (_underlineLinks && (_openLinksByDirectClick || (ev->modifiers() & Qt::ControlModifier))) setCursor(_mouseMarks ? Qt::IBeamCursor : Qt::ArrowCursor); update(_mouseOverHotspotArea);