Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    FullScreen with QVideoWidget under GNU/Linux

    General and Desktop
    2
    5
    2531
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • gagiD
      gagiD last edited by

      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

      1 Reply Last reply Reply Quote 0
      • gagiD
        gagiD last edited by

        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

        1 Reply Last reply Reply Quote 0
        • A
          andreyc last edited by

          "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);
          @

          1 Reply Last reply Reply Quote 0
          • A
            andreyc last edited by

            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);
            

            }
            @

            1 Reply Last reply Reply Quote 0
            • gagiD
              gagiD last edited by

              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.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post