FullScreen with QVideoWidget under GNU/Linux
-
Hello :)
I have problem with full screen mode. When i exit from full screen mode a strange widget show up(see on image).
I even built "this":http://qt-project.org/doc/qt-5/qtmultimediawidgets-player-example.html example from Qt Docs but same problem.This is how it's looking(QMediaPlayer Example):
!http://www.igreklik.com/slike/images/90244980958546940332.png(QMedia Player Example Problem)!
Is there any way to fix this?
Regards,
gagiD -
Hi,
Have anybody had this problem?
Does anybody have an idea how to solve this?There is my slot for full screen:
@
void Player::showFullScreenVideo() {
if (player->state() != QMediaPlayer::StoppedState) {
videoWidget->setParent(0);
videoWidget->showFullScreen();
}
}
@And event handler for exit from full screen:
@
void VideoWidget::keyPressEvent(QKeyEvent *event) {
if (event->key() == Qt::Key_Escape && isFullScreen()) {
showNormal();
setParent(myParentWidget);
myParent->vertical->insertWidget(0, this);event->accept(); } else { VideoWidget::keyPressEvent(event); }
}
@Regards
-
"QWidget doc":http://qt-project.org/doc/qt-5/qwidget.html#setWindowState suggests to use the followoing code to toggle between full-screen and normal mode
@
w->setWindowState(w->windowState() ^ Qt::WindowFullScreen);
@ -
I tried it on small example and it does not work as I expected.
I use the following code to toggle between states
@
MainWindow::enterFullScreen()
{
// Hide all elements that I don't need in full screen
ui->toolBar->hide();
ui->menuBar->hide();
ui->statusBar->hide();
// ....m_windowState = windowState(); setWindowState(m_windowState | Qt::WindowFullScreen); ui->actionLeaveFullScreen->setEnabled(true); ui->actionEnterFullScreen->setEnabled(false);
}
MainWindow::leaveFullScreen()
{
ui->toolBar->show();
ui->menuBar->show();
ui->statusBar->show();
// ....setWindowState(m_windowState); ui->actionLeaveFullScreen->setEnabled(false); ui->actionEnterFullScreen->setEnabled(true);
}
@ -
I used this for MainWindow and it's work fine:
@
void MainWindow::keyPressEvent(QKeyEvent *event) {
if (event->key() == Qt::Key_Escape) {
neki->setParent(this);
neki->showNormal();
event->accept();
} else {
MainWindow::keyPressEvent(event);
}
}void MainWindow::fS() {
neki->setParent(0);
neki->showFullScreen();
}
@But if i try this on QWidget which is child of QMainWindow it fails.