Hi,
In my application I have two different GraphicsWindowQT classes. On startup a user can select a mode and the window is loaded. My problem is if a user selects “New..†and changes to the opposite mode.
Below is the code I’ve written to swap between the two GraphicsWindowQT classes:
LoadingDialog *loading;
if(ConstructionObject::getConstructionType() == Ui::BUILDING)
widget = new BuildingOSGWidget(this, loading);
else
widget = new CaveOSGWidget(this, loading);
if(windowAlreadyCreated)
{
delete ui->threeD->layout();
ui->threeD = widget;
}
ui->threeD->setLayout(widget->layout());
ui->threeD->update();
QWidget *widget;
LoadingDialog *loading;
if(ConstructionObject::getConstructionType() == Ui::BUILDING)
widget = new BuildingOSGWidget(this, loading);
else
widget = new CaveOSGWidget(this, loading);
if(windowAlreadyCreated)
{
delete ui->threeD->layout();
ui->threeD = widget;
}
ui->threeD->setLayout(widget->layout());
ui->threeD->update();
To copy to clipboard, switch view to plain text mode
After this code runs, I get a blank blue screen. I know I can always shut down the application and reopen it, but I was hoping for a more elegant solution. If anyone has any suggestions I would appreciate it.
Thanks!
Braden
Side Node: When I say GraphicsWindowQT I'm referring to the OpenSceneGraph class.
Bookmarks