fix:middle mouse click open in new tab

This commit is contained in:
yifang 2022-03-04 00:17:21 +08:00
parent 4a96067e86
commit 269a7bcf48
3 changed files with 7 additions and 2 deletions

View file

@ -1110,6 +1110,7 @@ void ArticleView::linkClicked( QUrl const & url_ )
( kmod & ( Qt::ControlModifier | Qt::ShiftModifier ) ) ) ) ( kmod & ( Qt::ControlModifier | Qt::ShiftModifier ) ) ) )
{ {
// Mid button or Control/Shift is currently pressed - open the link in new tab // 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 ); emit openLinkInNewTab( url, ui.definition->url(), getCurrentArticle(), contexts );
} }
else else

View file

@ -135,8 +135,8 @@ void ArticleWebView::sendCustomMouseEvent( QEvent::Type type) {
void ArticleWebView::mouseReleaseEvent(QMouseEvent *event) { void ArticleWebView::mouseReleaseEvent(QMouseEvent *event) {
bool noMidButton = !( event->buttons() & Qt::MiddleButton ); bool noMidButton = !( event->buttons() & Qt::MiddleButton );
if ( midButtonPressed & noMidButton ) // if ( midButtonPressed & noMidButton )
midButtonPressed = false; // midButtonPressed = false;
} }
void ArticleWebView::doubleClickAction(QMouseEvent *event) { void ArticleWebView::doubleClickAction(QMouseEvent *event) {

View file

@ -32,6 +32,10 @@ public:
bool isMidButtonPressed() const bool isMidButtonPressed() const
{ return midButtonPressed; } { return midButtonPressed; }
void resetMidButtonPressed()
{
midButtonPressed = false;
}
void setSelectionBySingleClick( bool set ) void setSelectionBySingleClick( bool set )
{ selectionBySingleClick = set; } { selectionBySingleClick = set; }