0

I have videoplayer written on Qt 5.2.1 with quite complicated organization of widgets and layouts inside. I want to fullscreen my player after user press F11 so i wrote code like:

void SomeClass::setFullScreen(bool fullScreenModeOn) // SomeClass is centralWidget of MainWindow
{
    if (fullScreenModeOn && !player->isFullScreen())
    {
        vbox->removeWidget(player);
        player->setParent(0);
        player->showFullScreen();
        parentWidget()->hide(); // this one is MainWindow
    }
    else if (!fullScreenModeOn && player->isFullScreen())
    {
        player->hide();
        player->setParent(this);
        vbox->insertWidget(0, player);
        parentWidget()->show();
    }
}

I just show player widget as separate window and fullscreen it; when user press F11 again, else branch does exactly reverse things - add widget back to layout and show parent window. When i build this code in QtCreator 3.0.1 with latest Qt 5.2.1 - everything WORKS FINE!

But! When i try to run this app on my Ubuntu 13.10 with Qt 5.0.2 library i got following situation: after i switch off fullscreen mode player widget just disappears! After some debugging i found that player actually is on layout, but it's height became 0 and can't be changed back (because qlayout controls widget's size). I can set minimumHeight for player widget and it appears again, but don't resizes greater than minimum height.

So is there a workaround for this situation? Am i doing something wrong? Why this happens?

serg.v.gusev
  • 501
  • 4
  • 13
  • Is your QtCreator 3.0.1 running Qt 5.2.1 on a different machine to your Ubuntu one? What happens on your Ubuntu 13.10 machine if you compile with Qt 5.2.1? – RobbieE Apr 19 '14 at 07:24
  • I'm working on ubuntu 13.10 all the time. When i compile with Qt 5.2.1 sdk, ldd shows that output binary file linked with Qt 5.2.1 libraries (on my home directory) - this case works great. But when i, say, mv sdk directory (or try on another ubuntu 13.10), ldd shows that binary file is linked with system Qt 5.0.2 and my problem occurs. – serg.v.gusev Apr 19 '14 at 11:20
  • Try to call `player->show()` after calling `insertWidget`. – Pavel Strakhov Apr 19 '14 at 17:00
  • show() is not working. Height of player is 0 but it is visible (i mean it is on layout and isVisible() returns true). – serg.v.gusev Apr 21 '14 at 09:41

0 Answers0