From 269a7bcf4831a7e1a3405b09de4ac63f0b233fc5 Mon Sep 17 00:00:00 2001 From: yifang Date: Fri, 4 Mar 2022 00:17:21 +0800 Subject: [PATCH] fix:middle mouse click open in new tab --- articleview.cc | 1 + articlewebview.cc | 4 ++-- articlewebview.hh | 4 ++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/articleview.cc b/articleview.cc index 2dc6926c..da069488 100644 --- a/articleview.cc +++ b/articleview.cc @@ -1110,6 +1110,7 @@ void ArticleView::linkClicked( QUrl const & url_ ) ( kmod & ( Qt::ControlModifier | Qt::ShiftModifier ) ) ) ) { // Mid button or Control/Shift is currently pressed - open the link in new tab + ui.definition->resetMidButtonPressed(); emit openLinkInNewTab( url, ui.definition->url(), getCurrentArticle(), contexts ); } else diff --git a/articlewebview.cc b/articlewebview.cc index fe127fa7..ca2c5d44 100644 --- a/articlewebview.cc +++ b/articlewebview.cc @@ -135,8 +135,8 @@ void ArticleWebView::sendCustomMouseEvent( QEvent::Type type) { void ArticleWebView::mouseReleaseEvent(QMouseEvent *event) { bool noMidButton = !( event->buttons() & Qt::MiddleButton ); - if ( midButtonPressed & noMidButton ) - midButtonPressed = false; +// if ( midButtonPressed & noMidButton ) +// midButtonPressed = false; } void ArticleWebView::doubleClickAction(QMouseEvent *event) { diff --git a/articlewebview.hh b/articlewebview.hh index 18ddd8f7..22d227c3 100644 --- a/articlewebview.hh +++ b/articlewebview.hh @@ -32,6 +32,10 @@ public: bool isMidButtonPressed() const { return midButtonPressed; } + void resetMidButtonPressed() + { + midButtonPressed = false; + } void setSelectionBySingleClick( bool set ) { selectionBySingleClick = set; }