Merge pull request #1356 from xiaoyifang/fix/middle-button

fix: middle button does not work
This commit is contained in:
xiaoyifang 2024-01-04 20:39:56 +08:00 committed by GitHub
commit 804aa29788
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -80,8 +80,14 @@ bool ArticleWebView::eventFilter( QObject * obj, QEvent * ev )
singleClickAction( pe ); singleClickAction( pe );
} ); } );
} }
if ( pe->buttons() & Qt::MiddleButton ) if ( pe->buttons() & Qt::MiddleButton ) {
midButtonPressed = true; midButtonPressed = true;
QTimer::singleShot( 100, this, [ = ]() {
sendCustomMouseEvent( QEvent::MouseButtonPress );
sendCustomMouseEvent( QEvent::MouseButtonRelease );
} );
return false;
}
} }
if ( ev->type() == QEvent::MouseButtonRelease ) { if ( ev->type() == QEvent::MouseButtonRelease ) {
auto pe = dynamic_cast< QMouseEvent * >( ev ); auto pe = dynamic_cast< QMouseEvent * >( ev );