1

I want to undock a QWidget from a QTabWiget (is set as centralWidget). The tab contains some Open Scene Graph content (OpenGL Window). When removing the Tab from the list and putting it into a new Dialog Window (=> undocking from tab) the scene data seems to be corrupt. It works with "standard widgets" but the osg seems to forget the scene.

Surprisingly, undocking works when using a QDockWidget (scene is visible after undocking the window).

Anyone knows how to undock a tab without corrupting the osgViewer?

Code called for to undock from tab and show in new dialog window:

QWidget* gv = // points to an osgViewer in a qt widget 
QDialog* dlg = new QDialog(this); 
dlg->setWindowTitle("hello earth"); 
QHBoxLayout* pMainLay = new QHBoxLayout; 
gv->setMinimumSize(100,100); 
gv->setGeometry(100,100,300,300); 
pMainLay->addWidget(gv); 
dlg->setLayout(pMainLay); 
ui->tabWidget->removeTab(0); // removes the tab at position 0 (docked window)
dlg->show(); // should show the undocked dialog

There is nothing to see in the new dialog. Did I missed something? How to "copy" the osg view properly into a new widget/dialog? Should I use a composite viewer for this kind of task? It seems there is not even the empty osg view visible (no blue canvas)...

Beachwalker
  • 7,685
  • 6
  • 52
  • 94

1 Answers1

-1

It could be that something's going screwy when you add the osgViewer to another widget before removing it from the QTabWidget. Changing the order might help.

QWidget* gv = // points to an osgViewer in a qt widget 
ui->tabWidget->removeTab(0); // removes the tab at position 0 (docked window)
QDialog* dlg = new QDialog(this); 
dlg->setWindowTitle("hello earth"); 
QHBoxLayout* pMainLay = new QHBoxLayout; 
pMainLay->addWidget(gv); 
dlg->setLayout(pMainLay); 
dlg->show(); // should show the undocked dialog
Phlucious
  • 3,704
  • 28
  • 61