Code is very simple and working for x86 version: (Qt 4.8)
@if( fullscreen)
{
this->setWindowFlags( Qt::Window);
showFullScreen();
}
else
{
this->setWindowFlags( Qt::SubWindow);
showNormal();
}@

this == QWidget with parent.

On arm version fullscreen works 100% but getting back to normal widget embedded in another widget ends with flying widget not docked in it's previous location. This is incosistent with x86 version which embeds it to previous location.

compositor: wayland