61QVideoWidget::QVideoWidget(QWidget *parent)
63 , d_ptr(
new QVideoWidgetPrivate)
66 d_ptr->videoWindow =
new QVideoWindow;
67 d_ptr->videoWindow->setFlag(Qt::WindowTransparentForInput,
true);
68 d_ptr->windowContainer = QWidget::createWindowContainer(d_ptr->videoWindow,
this, Qt::WindowTransparentForInput);
69 d_ptr->windowContainer->move(0, 0);
70 d_ptr->windowContainer->resize(size());
72 connect(d_ptr->videoWindow, &QVideoWindow::aspectRatioModeChanged,
this, &QVideoWidget::aspectRatioModeChanged);
112void QVideoWidget::setFullScreen(
bool fullScreen)
115 if (isFullScreen() == fullScreen)
118 Qt::WindowFlags flags = windowFlags();
122 QPoint position = mapToGlobal(QPoint(0,0));
123 d->nonFullScreenFlags = flags & (Qt::Window | Qt::SubWindow);
124 d_ptr->nonFullscreenPos = pos();
126 flags &= ~Qt::SubWindow;
127 setWindowFlags(flags);
134 flags &= ~(Qt::Window | Qt::SubWindow);
135 flags |= d->nonFullScreenFlags;
136 setWindowFlags(flags);
139 move(d_ptr->nonFullscreenPos);
140 d_ptr->nonFullscreenPos = {};
162bool QVideoWidget::event(QEvent *event)
166 if (event->type() == QEvent::WindowStateChange) {
167 bool fullScreen =
bool(windowState() & Qt::WindowFullScreen);
168 if (fullScreen != d->wasFullScreen) {
169 emit fullScreenChanged(fullScreen);
170 d->wasFullScreen = fullScreen;
174 return QWidget::event(event);