Hi all, I have following problem.
I have a widget (inherited QGraphicsView) that is somewhere inside central widget (in a groupbox with layout).
I want to have a possibility showing it fullscreen and then back it to normal.
Following code works great for going full screen:
void QGraphicsInheritedClass::goFullScreen()
{
this->setWindowFlags(Qt::Window);
this->setWindowState(Qt::WindowFullScreen);
this->show();
}
but using following code for going back:
void QGraphicsInheritedClass::goNormal()
{
this->setWindowState(Qt::WindowNoState);
this->setWindowFlags(Qt::Widget);
this->show();
}
destroys old geometries of parent widget (GroupBox is making bigger).
I tried calling updateGeometry() but this doesnt solve that.
Any idea how to solve that?
edit: this is somehow related to zooming. When I dont zoom groupbox keeps it size.
edit2: seems following code fixed my problem:
void QGraphicsInheritedClass::goNormal()
{
this->setWindowState(Qt::WindowNoState);
this->setWindowFlags(Qt::Widget);
QGraphicsScene scene;
QGraphicsScene * old = this->scene();
this->setScene(&scene);
this->show();
this->setScene(old);
}
any better idea?
Bookmarks