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?