How exit FullScreen from videoWidget ? thanks for help
Hello everyone,
I am playing a video using phonon videoplayer,and call setFullScreen() to enter full screen mode,but how can i exit it ? the mouseEvent isn't work,my videoPlayer is inherit from QWidget.
Qt Document's Description:
Warning: When switching to full screen mode using setFullScreen(), the widget onto which the video is rendered is shown as a top-level window. Key event forwarding is handled by VideoWidget, but if you need to handle other events, e.g., mouse events, you should handle fullscreen mode yourself.
i can't understand what's it mean,and thanks for help.
Re: How exit FullScreen from videoWidget ? thanks for help
Quote:
the mouseEvent isn't work
Maybe your vodeoPlayer not in focus. Try set FocusPolicy.
Re: How exit FullScreen from videoWidget ? thanks for help
Quote:
Originally Posted by
Jonny174
Maybe your vodeoPlayer not in focus. Try set FocusPolicy.
the widget onto which the video is rendered is shown as a top-level window,maybe your solution is effective.thank you for yuor help.
Re: How exit FullScreen from videoWidget ? thanks for help
solution:
// eventFilter
bool videoPlayer::eventFilter(QObject *obj, QEvent *event)
{
QMouseEvent *mouse = static_cast<QMouseEvent *>(event); // mouseEvent
if (obj == videoWidget) {
// double clicked to enter full screen or exit full screen
if (event->type() == QEvent::MouseButtonDblClick) {
if(mouse->button() == Qt::LeftButton){
if(!bFull){ // is not full screen and enter full screen
videoWidget->enterFullScreen();
bFull = true;
}
else{ // exit full screen
videoWidget->exitFullScreen();
bFull = false;
}
return true;
}
}
else
return false;
}
else
return videoPlayer::eventFilter(obj, event);
}