Skip to content
Snippets Groups Projects
Commit bb0e6863 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

avoid widget showing up twice

QT5 shows a widget twice when you set a parent at initialization
and reset the parent later. This is exactly what happens when a
widget is initialized and passed to AddWidget in the gosty app.
The solution is to initialize them without a parent and let
the AddWidget function taking care of it.
parent 996dd9c1
No related branches found
No related tags found
No related merge requests found
......@@ -26,7 +26,7 @@ from board import Board
panels=gui.GostyApp.Instance().perspective.panels
#Create Widget
tetris=Board(panels.qobject)
tetris=Board()
#Wrap widget to Qt Widget
wid=gui.Widget(tetris)
......
......@@ -122,17 +122,8 @@ ost::img::gui::DataViewer* GostyApp::CreateDataViewer(const ost::img::ImageHandl
}
else
{
viewer=new ost::img::gui::DataViewer(main_,d,name);
QMdiSubWindow* mdi=new QMdiSubWindow(this->GetPerspective()->GetMainArea());
mdi->setWindowTitle(name);
mdi->setWidget(viewer);
mdi->setFocusProxy(viewer);
viewer->setAttribute(Qt::WA_DeleteOnClose);
mdi->setAttribute(Qt::WA_DeleteOnClose);
viewer->setParent(mdi);
this->GetPerspective()->GetMainArea()->addSubWindow(mdi);
mdi->showMaximized();
connect(viewer,SIGNAL(released()),mdi,SLOT(close()));
viewer=new ost::img::gui::DataViewer(NULL,d,name);
this->GetPerspective()->GetMainArea()->AddWidget(name, viewer);
}
return viewer;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment