QVideoWidget: fixed setFullScreen(false) on the Xcb platform.

Fixed exiting fullscreen when a QVideoWidget is embedded in another QWidget.
Requires change I3616dc0f in qtbase to work.
Because of a bug in some X window managers, the order in which
setWindowFlags() and showNormal() are called has been changed.

Change-Id: I335d47a3a1d9ce517978cad35597d72312150db1
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
This commit is contained in:
Yoann Lopes
2012-09-28 17:53:11 +02:00
committed by The Qt Project
parent 06827f5d6e
commit 439d5b0e53
2 changed files with 8 additions and 9 deletions

View File

@@ -57,7 +57,7 @@ VideoWidget::VideoWidget(QWidget *parent)
void VideoWidget::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Escape && isFullScreen()) {
showNormal();
setFullScreen(false);
event->accept();
} else if (event->key() == Qt::Key_Enter && event->modifiers() & Qt::Key_Alt) {

View File

@@ -720,9 +720,9 @@ void QVideoWidget::setFullScreen(bool fullScreen)
{
Q_D(QVideoWidget);
if (fullScreen) {
Qt::WindowFlags flags = windowFlags();
Qt::WindowFlags flags = windowFlags();
if (fullScreen) {
d->nonFullScreenFlags = flags & (Qt::Window | Qt::SubWindow);
flags |= Qt::Window;
flags &= ~Qt::SubWindow;
@@ -730,6 +730,10 @@ void QVideoWidget::setFullScreen(bool fullScreen)
showFullScreen();
} else {
flags &= ~(Qt::Window | Qt::SubWindow); //clear the flags...
flags |= d->nonFullScreenFlags; //then we reset the flags (window and subwindow)
setWindowFlags(flags);
showNormal();
}
}
@@ -910,13 +914,8 @@ bool QVideoWidget::event(QEvent *event)
if (d->currentControl)
d->currentControl->setFullScreen(false);
if (d->wasFullScreen) {
flags &= ~(Qt::Window | Qt::SubWindow); //clear the flags...
flags |= d->nonFullScreenFlags; //then we reset the flags (window and subwindow)
setWindowFlags(flags);
if (d->wasFullScreen)
emit fullScreenChanged(d->wasFullScreen = false);
}
}
}
return QWidget::event(event);