@@ -46,7 +46,8 @@ using namespace SCIRun::Render;
4646// ------------------------------------------------------------------------------
4747ViewSceneDialog::ViewSceneDialog (const std::string& name, ModuleStateHandle state,
4848 QWidget* parent /* = 0 */ )
49- : ModuleDialogGeneric(state, parent), shown_(false ), itemManager_(new ViewSceneItemManager)
49+ : ModuleDialogGeneric(state, parent), mConfigurationDock(0 ), shown_(false ),
50+ itemManager_(new ViewSceneItemManager)
5051{
5152 setupUi (this );
5253 setWindowTitle (QString::fromStdString (name));
@@ -63,7 +64,7 @@ ViewSceneDialog::ViewSceneDialog(const std::string& name, ModuleStateHandle stat
6364 fmt.setDoubleBuffer (true );
6465 fmt.setDepthBufferSize (24 );
6566
66- mGLWidget = new GLWidget (new QtGLContext (fmt));
67+ mGLWidget = new GLWidget (new QtGLContext (fmt), parentWidget () );
6768
6869 if (mGLWidget ->isValid ())
6970 {
@@ -96,26 +97,18 @@ ViewSceneDialog::ViewSceneDialog(const std::string& name, ModuleStateHandle stat
9697
9798 state->connect_state_changed (boost::bind (&ViewSceneDialog::newGeometryValueForwarder, this ));
9899 connect (this , SIGNAL (newGeometryValueForwarder ()), this , SLOT (newGeometryValue ()));
99-
100- addConfigurationDock (QString::fromStdString (name));
101100}
102101
103- // ------------------------------------------------------------------------------
104- ViewSceneDialog::~ViewSceneDialog ()
105- {
106- }
107-
108- // ------------------------------------------------------------------------------
109102void ViewSceneDialog::closeEvent (QCloseEvent *evt)
110103{
111104 // NOTE: At one point this was required because the renderer was
112105 // multi-threaded. It is likely we will run into the same issue in the
113106 // future. Kept for future reference.
114107 // glLayout->removeWidget(mGLWidget);
115108 mGLWidget ->close ();
109+ ModuleDialogGeneric::closeEvent (evt);
116110}
117111
118- // ------------------------------------------------------------------------------
119112void ViewSceneDialog::newGeometryValue ()
120113{
121114 LOG_DEBUG (" ViewSceneDialog::asyncExecute before locking" );
@@ -371,6 +364,9 @@ void ViewSceneDialog::lookDownAxisZ(int upIndex, glm::vec3& up)
371364// ------------------------------------------------------------------------------
372365void ViewSceneDialog::configurationButtonClicked ()
373366{
367+ if (!mConfigurationDock )
368+ addConfigurationDock (windowTitle ());
369+
374370 showConfiguration_ = !mConfigurationDock ->isVisible ();
375371 mConfigurationDock ->setEnabled (showConfiguration_);
376372 mConfigurationDock ->setVisible (showConfiguration_);
@@ -441,7 +437,7 @@ void ViewSceneDialog::addObjectToggleMenu()
441437
442438void ViewSceneDialog::addViewBarButton ()
443439{
444- QPushButton* viewBarBtn = new QPushButton (this );
440+ QPushButton* viewBarBtn = new QPushButton ();
445441 viewBarBtn->setToolTip (" Show View Options" );
446442 viewBarBtn->setText (" Views" );
447443 viewBarBtn->setAutoDefault (false );
@@ -499,7 +495,7 @@ void ViewSceneDialog::addViewOptions()
499495
500496void ViewSceneDialog::addConfigurationButton ()
501497{
502- QPushButton* configurationButton = new QPushButton (this );
498+ QPushButton* configurationButton = new QPushButton ();
503499 configurationButton->setToolTip (" Open/Close Configuration Menu" );
504500 configurationButton->setText (" Configure" );
505501 configurationButton->setAutoDefault (false );
@@ -513,34 +509,37 @@ void ViewSceneDialog::addConfigurationDock(const QString& viewName)
513509{
514510 QString name = viewName + " Configuration" ;
515511 mConfigurationDock = new ViewSceneControlsDock (name, this );
516- mConfigurationDock ->close ( );
512+ mConfigurationDock ->setVisible ( false );
517513
518514 showConfiguration_ = false ;
519515}
520516
521- void ViewSceneDialog::closeConfigurationDock ()
517+ void ViewSceneDialog::hideConfigurationDock ()
522518{
523- showConfiguration_ = mConfigurationDock ->isVisible ();
524- if (showConfiguration_)
525- {
526- configurationButtonClicked ();
527- }
519+ if (mConfigurationDock )
520+ {
521+ showConfiguration_ = mConfigurationDock ->isVisible ();
522+ if (showConfiguration_)
523+ {
524+ configurationButtonClicked ();
525+ }
526+ }
528527}
529528
530529void ViewSceneDialog::showEvent (QShowEvent* evt)
531530{
532- ModuleDialogGeneric::showEvent (evt);
533531 if (!shown_)
534532 {
535533 autoViewClicked ();
536534 shown_ = true ;
537535 }
536+ ModuleDialogGeneric::showEvent (evt);
538537}
539538
540539void ViewSceneDialog::hideEvent (QHideEvent* evt)
541540{
542- ModuleDialogGeneric::hideEvent (evt );
543- closeConfigurationDock ( );
541+ hideConfigurationDock ( );
542+ ModuleDialogGeneric::hideEvent (evt );
544543}
545544
546545ViewSceneItemManager::ViewSceneItemManager () : model_(new QStandardItemModel(3 , 1 ))
0 commit comments