Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. FullScreen with QVideoWidget under GNU/Linux
QtWS25 Last Chance

FullScreen with QVideoWidget under GNU/Linux

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 2.8k Views
  • 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.
  • gagiDG Offline
    gagiDG Offline
    gagiD
    wrote on last edited by
    #1

    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
    0
    • gagiDG Offline
      gagiDG Offline
      gagiD
      wrote on last edited by
      #2

      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
      0
      • A Offline
        A Offline
        andreyc
        wrote on last edited by
        #3

        "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
        0
        • A Offline
          A Offline
          andreyc
          wrote on last edited by
          #4

          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
          0
          • gagiDG Offline
            gagiDG Offline
            gagiD
            wrote on last edited by
            #5

            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
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved