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. Full screen osx Widget - Works the first time then fails.
Forum Updated to NodeBB v4.3 + New Features

Full screen osx Widget - Works the first time then fails.

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.5k Views 1 Watching
  • 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.
  • J Offline
    J Offline
    jolson
    wrote on last edited by
    #1

    I have taken over a project that has a video player, it includes the capability to switch to full screen. On OS X the full screen switch works as expected. If I switch from full screen back to the normal size screen, then attempt to switch back to full screen.
    The widget is removed from its parent (expected). But instead of full screen its now displayed the same size as the original but now in the upper left hand side of the display (detached from our app).

    When we switch to full screen we set the widget parent to 0 then set full screen. The second time we attempt to switch to full screen the "parent switch" clearly works but the action to switch to full screen is failing for some unknown reason.

    Note: If we run this app on a windows machine it works perfectly.

    @
    void VideoPlayerWidget::setFullScreen(bool entering)
    {
    if(entering == true)
    {
    ui.frameVideoHeader->hide();
    ui.buttonFullScreenMode->hide();
    emit enterFullScreen();
    }
    else
    {
    ui.frameVideoHeader->show();
    ui.buttonFullScreenMode->show();
    emit exitFullScreen();
    }
    }
    @

    [EDIT: code formatting, please wrap in @-tags, Volker]

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jolson
      wrote on last edited by
      #2

      Ok, I solved the problem but would be interested if anyone could provide me with an explanation.

      What I found was when the emit fullscreen is called and the windows state the first time (successful full screen) the widget window state is - Qt::WindowNoState. After reverting back to "normal size" the second call to enterFullScreen. The windows state was Qt::WindowFullScreen which is not correct.

      To fix my problem I added the line

      @
      if(this->windowState()==4)
      this->setWindowState(this->windowState() ^ Qt::WindowFullScreen);
      @

      to force the window state.
      After adding this line the full screen/normal screen switch works as expected every time.

      @
      // SIGNAL 0
      void VideoPlayerWidget::enterFullScreen()
      {
      if(this->windowState()==4) this->setWindowState(this->windowState() ^ Qt::WindowFullScreen);
      QMetaObject::activate(this, &staticMetaObject , 0, 0);

      }
      @

      [EDIT: code formatting, Volker]

      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