Skip to content

Commit

Permalink
Merge pull request wang-bin#983 from Jiangxumin/master
Browse files Browse the repository at this point in the history
examples/player add mouse left button double clicked showfullscreen
  • Loading branch information
wang-bin authored Oct 30, 2017
2 parents 616fae1 26944f2 commit 428cb59
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions examples/player/EventFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 297,21 @@ bool EventFilter::eventFilter(QObject *watched, QEvent *event)
}
}
break;

case QEvent:: QEvent::MouseButtonDblClick: {
QMouseEvent *me = static_cast<QMouseEvent*>(event);
Qt::MouseButton mbt = me->button();
QWidget *mpWindow = static_cast<QWidget*>(player->parent());
if (mbt == Qt::LeftButton) {
if (Qt::WindowFullScreen ==mpWindow->windowState()){
mpWindow->setWindowState(mpWindow->windowState() ^ Qt::WindowFullScreen);
}else{
mpWindow->showFullScreen();
}
}
break;
}

case QEvent::GraphicsSceneContextMenu: {
QGraphicsSceneContextMenuEvent *e = static_cast<QGraphicsSceneContextMenuEvent*>(event);
showMenu(e->screenPos());
Expand Down Expand Up @@ -346,6 361,7 @@ bool WindowEventFilter::eventFilter(QObject *watched, QEvent *event)
}
return false;
}

if (event->type() == QEvent::MouseButtonPress) {
QMouseEvent *me = static_cast<QMouseEvent*>(event);
Qt::MouseButton mbt = me->button();
Expand Down

0 comments on commit 428cb59

Please sign in to comment.