aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTomas Åkesson <tomas@entropic.se>2023-04-04 21:45:28 +0200
committerFelix Queißner <felix@ib-queissner.de>2023-04-06 20:55:37 +0200
commitd47e3d3f54aa66b37f8a1bb45150b8510c95c343 (patch)
treedf018f843154600690da56aa54bc8f2b3ffa7056 /src
parentd937a0c32e418414c7e9911927a1518ac586b9d4 (diff)
Allow middle-click to open new tab when text is selected
If text is selected, middle-click will not be forwarded to the function that opens the link in a new tab. So this change will deselect any selected text before trying to open a new tab. Fixes #253
Diffstat (limited to 'src')
-rw-r--r--src/widgets/kristalltextbrowser.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/widgets/kristalltextbrowser.cpp b/src/widgets/kristalltextbrowser.cpp
index a4fc4e8..91b3bb7 100644
--- a/src/widgets/kristalltextbrowser.cpp
+++ b/src/widgets/kristalltextbrowser.cpp
@@ -48,6 +48,9 @@ KristallTextBrowser::KristallTextBrowser(QWidget *parent) :
void KristallTextBrowser::mouseReleaseEvent(QMouseEvent *event)
{
if(event->button() == Qt::MiddleButton) {
+ // Deselect any selection. Otherwise the click won't register.
+ setTextCursor(cursorForPosition(event->pos()));
+
// Fake a middle-click event here
QMouseEvent fake_event {
event->type(),