Salome HOME
Turning PARAVIS into a Light module
[modules/paravis.git] / src / PVGUI / PVGUI_Module_widgets.cxx
1 // PARAVIS : ParaView wrapper SALOME module
2 //
3 // Copyright (C) 2010-2015  CEA/DEN, EDF R&D
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
18 //
19 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 //
21 // File   : PVGUI_Module_MenuActions.cxx
22 // Author : Margarita KARPUNINA
23 //
24
25 #include "PVGUI_Module.h"
26 #include "PVViewer_ViewManager.h"
27 #include "PVViewer_GUIElements.h"
28
29 #include <QtxActionToolMgr.h>
30 #include <LightApp_Application.h>
31 #include <SUIT_Desktop.h>
32
33 #include <QApplication>
34 #include <QAction>
35 #include <QDockWidget>
36 #include <QToolBar>
37 #include <QStatusBar>
38 #include <QShortcut>
39 #include <QScrollArea>
40 #include <QVBoxLayout>
41 #include <QShowEvent>
42 #include <QToolButton>
43
44 #include <pqAnimationViewWidget.h> 
45 #include <pqAnimationWidget.h> 
46
47 #include <pqApplicationCore.h>
48 #include <pqComparativeVisPanel.h>
49 #include <pqPipelineBrowserWidget.h>
50 #include <pqProxyInformationWidget.h>
51 #include <pqSettings.h>
52 #include <pqDataInformationWidget.h>
53 #include <pqPVAnimationWidget.h>
54 #include <pqFindDataSelectionDisplayFrame.h>
55 #include <pqMultiBlockInspectorPanel.h>
56 #include <pqProgressWidget.h>
57 #include <pqProgressManager.h>
58 #include <pqPropertiesPanel.h>
59
60 #include <pqApplicationCore.h>
61 #include <pqPluginManager.h>
62 #include <pqParaViewMenuBuilders.h>
63 #include <pqCollaborationPanel.h>
64 #include <pqMemoryInspectorPanel.h>
65 #include <pqColorMapEditor.h>
66 #include <pqDeleteReaction.h>
67
68 #include <vtkPVGeneralSettings.h>
69
70 class ResizeHelper : public pqPVAnimationWidget
71 {
72   // TEMPORARY WORKAROUND AROUND PARAVIEW 3.14 BUG:
73   // WHEN ANIMATION VIEW IS RESIZED, ITS CONTENTS IS NOT PREPERLY RE-ARRANGED
74   // CAUSING SOME CONTROLS TO STAY NON-VISIBLE
75   // THIS BUG IS NATURALLY FIXED BY ADDING
76   //      this->updateGeometries();
77   // TO THE
78   //     void pqAnimationWidget::resizeEvent(QResizeEvent* e);
79   // BUT THIS CANNOT BE DONE DIRECTLY, SINCE CORRESPONDING API IS NOT PUBLIC
80   // THE ONLY WAY TO DO THIS BY SENDING SHOW EVENT TO THE WIDGET
81
82 public:
83   ResizeHelper( QWidget* parent ) : pqPVAnimationWidget( parent ) {}
84 protected:
85   void resizeEvent(QResizeEvent* e)
86   {
87     pqAnimationWidget* w = findChild<pqAnimationWidget*>( "pqAnimationWidget" );
88     if ( w ) {
89       QShowEvent e;
90       QApplication::sendEvent( w, &e );
91     }
92     pqPVAnimationWidget::resizeEvent( e );
93   }
94 };
95
96 /*!
97   \brief Create dock widgets for ParaView widgets such as object inspector, pipeline browser, etc.
98   ParaView pqMainWindowCore class is fully responsible for these dock widgets' contents.
99   ==> To update this function, see the reference set up of ParaView in Application/Paraview/ParaviewMainWindow.ui
100 */
101 void PVGUI_Module::setupDockWidgets()
102 {
103   SUIT_Desktop* desk = application()->desktop();
104   PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance(desk);
105  
106   desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
107   desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
108   desk->setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North);
109
110   // Pipeline
111   QDockWidget* pipelineBrowserDock = new QDockWidget( tr( "TTL_PIPELINE_BROWSER" ), desk );
112   pipelineBrowserDock->setObjectName("pipelineBrowserDock");
113   pipelineBrowserDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
114   desk->addDockWidget( Qt::LeftDockWidgetArea, pipelineBrowserDock );
115   pqPipelineBrowserWidget* browser = guiElements->getPipelineBrowserWidget();
116   pipelineBrowserDock->setWidget(browser);
117   myDockWidgets[pipelineBrowserDock] = true;
118   pipelineBrowserDock->hide();
119
120   // PROPERTIES, DISPLAY and VIEW:
121   // See ParaViewMainWindow.cxx - those three panels can be separated or grouped.
122   pqSettings *settings = pqApplicationCore::instance()->settings();
123
124   //    Properties dock (previously called OBJECT_INSPECTOR)
125   QDockWidget* propertiesDock = new QDockWidget( tr( "TTL_OBJECT_INSPECTOR" ), desk );
126   propertiesDock->setObjectName("propertiesDock");
127   propertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea );
128   desk->addDockWidget( Qt::LeftDockWidgetArea, propertiesDock );
129
130   pqPropertiesPanel* propertiesPanel = guiElements->getPropertiesPanel();
131   propertiesDock->setWidget(propertiesPanel);
132   connect( propertiesPanel, SIGNAL( helpRequested(const QString&, const QString&) ),  this, SLOT( showHelpForProxy(const QString&, const QString&) ) );
133   //            hook delete to pqDeleteReaction.
134   QAction* tempDeleteAction = new QAction(this);
135   pqDeleteReaction* handler = new pqDeleteReaction(tempDeleteAction);
136   handler->connect(propertiesPanel, SIGNAL(deleteRequested(pqPipelineSource*)), SLOT(deleteSource(pqPipelineSource*)));
137   myDockWidgets[propertiesDock] = true;
138   propertiesDock->hide();
139
140   // Display dock
141   QDockWidget* displayPropertiesDock = new QDockWidget( tr( "TTL_DISPLAY" ), desk );
142   displayPropertiesDock->setObjectName("displayPropertiesDock");
143   displayPropertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea );
144   desk->addDockWidget( Qt::LeftDockWidgetArea, displayPropertiesDock );
145
146   pqPropertiesPanel* displayPropertiesPanel = new pqPropertiesPanel();
147   displayPropertiesPanel->setObjectName("displayPropertiesPanel");
148   displayPropertiesPanel->setProperty("panelMode", QVariant(2));  // probably to have only the Display part
149   displayPropertiesDock->setWidget(displayPropertiesPanel);
150   myDockWidgets[displayPropertiesDock] = false;
151   displayPropertiesDock->hide();
152
153   // View dock
154   QDockWidget* viewPropertiesDock = new QDockWidget( tr( "TTL_VIEW_PANEL" ), desk );
155   viewPropertiesDock->setObjectName("viewPropertiesDock");
156   viewPropertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea );
157   desk->addDockWidget( Qt::LeftDockWidgetArea, viewPropertiesDock );
158
159   pqPropertiesPanel* viewPropertiesPanel = new pqPropertiesPanel();
160   viewPropertiesPanel->setObjectName("viewPropertiesPanel");
161   viewPropertiesPanel->setProperty("panelMode", QVariant(4)); // probably to have only the View part
162   viewPropertiesDock->setWidget(viewPropertiesPanel);
163   myDockWidgets[viewPropertiesDock] = false;
164   viewPropertiesDock->hide();
165
166   // Taken from ParaViewMainWindow.cxx:
167   int propertiesPanelMode = settings->value(
168       "GeneralSettings.PropertiesPanelMode", vtkPVGeneralSettings::ALL_IN_ONE).toInt();
169   switch (propertiesPanelMode)
170   {
171     case vtkPVGeneralSettings::SEPARATE_DISPLAY_PROPERTIES:
172       viewPropertiesDock->hide();
173       propertiesPanel->setPanelMode(
174           pqPropertiesPanel::SOURCE_PROPERTIES|pqPropertiesPanel::VIEW_PROPERTIES);
175       break;
176
177     case vtkPVGeneralSettings::SEPARATE_VIEW_PROPERTIES:
178       displayPropertiesDock->hide();
179       propertiesPanel->setPanelMode(
180           pqPropertiesPanel::SOURCE_PROPERTIES|pqPropertiesPanel::DISPLAY_PROPERTIES);
181       break;
182
183     case vtkPVGeneralSettings::ALL_SEPARATE:
184       propertiesPanel->setPanelMode(pqPropertiesPanel::SOURCE_PROPERTIES);
185       break;
186
187     case vtkPVGeneralSettings::ALL_IN_ONE:
188     default:
189       propertiesPanel->setPanelMode(
190                 pqPropertiesPanel::SOURCE_PROPERTIES|pqPropertiesPanel::VIEW_PROPERTIES|pqPropertiesPanel::DISPLAY_PROPERTIES);
191       viewPropertiesDock->hide();
192       displayPropertiesDock->hide();
193       break;
194   }
195
196   // Information dock
197   QDockWidget* informationDock = new QDockWidget(tr( "TTL_INFORMATION" ), desk);
198   informationDock->setObjectName("informationDock");
199
200   QWidget* informationWidgetFrame = new QWidget(informationDock);
201   informationWidgetFrame->setObjectName("informationWidgetFrame");
202
203   QVBoxLayout* verticalLayout_2 = new QVBoxLayout(informationWidgetFrame);
204   verticalLayout_2->setSpacing(0);
205   verticalLayout_2->setContentsMargins(0, 0, 0, 0);
206
207   QScrollArea* informationScrollArea = new QScrollArea(informationWidgetFrame);
208   informationScrollArea->setObjectName("informationScrollArea") ;
209   informationScrollArea->setWidgetResizable(true);
210
211   pqProxyInformationWidget* informationWidget = new pqProxyInformationWidget();
212   informationWidget->setObjectName("informationWidget");
213   informationWidget->setGeometry(QRect(0, 0, 77, 214));
214   informationScrollArea->setWidget(informationWidget);
215
216   verticalLayout_2->addWidget(informationScrollArea);
217   informationDock->setWidget(informationWidgetFrame);
218
219   myDockWidgets[informationDock] = true;
220
221   desk->tabifyDockWidget(propertiesDock, viewPropertiesDock);
222   desk->tabifyDockWidget(propertiesDock, displayPropertiesDock);
223   desk->tabifyDockWidget(propertiesDock, informationDock);
224   propertiesDock->raise();
225
226   // Statistic View
227   QDockWidget* statisticsViewDock  = new QDockWidget( tr( "TTL_STATISTICS_VIEW" ), desk );
228   statisticsViewDock->setObjectName("statisticsViewDock");
229   statisticsViewDock->setAllowedAreas(Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|
230                                       Qt::NoDockWidgetArea|Qt::RightDockWidgetArea );
231   desk->addDockWidget( Qt::BottomDockWidgetArea, statisticsViewDock );
232   pqDataInformationWidget* aStatWidget = new pqDataInformationWidget(statisticsViewDock);
233   statisticsViewDock->setWidget(aStatWidget);
234   myDockWidgets[statisticsViewDock] = false; // hidden by default
235
236   //Animation view
237   QDockWidget* animationViewDock     = new QDockWidget( tr( "TTL_ANIMATION_VIEW" ), desk );
238   animationViewDock->setObjectName("animationViewDock");
239   desk->addDockWidget( Qt::BottomDockWidgetArea, animationViewDock );
240   pqPVAnimationWidget* animation_panel = new ResizeHelper(animationViewDock); // [ABN] was resizeHelper
241   animationViewDock->setWidget(animation_panel);
242   myDockWidgets[animationViewDock] = false; // hidden by default
243
244   desk->tabifyDockWidget(animationViewDock,  statisticsViewDock);
245
246   // Selection inspector
247   QDockWidget* selectionDisplayDock = new QDockWidget( tr( "TTL_SELECTION_INSPECTOR" ), desk );
248   selectionDisplayDock->setObjectName("selectionInspectorDock");
249   selectionDisplayDock->setAllowedAreas( Qt::AllDockWidgetAreas );
250   desk->addDockWidget( Qt::LeftDockWidgetArea, selectionDisplayDock );
251   pqFindDataSelectionDisplayFrame* aSelInspector = new pqFindDataSelectionDisplayFrame(selectionDisplayDock);
252   selectionDisplayDock->setWidget(aSelInspector);
253   myDockWidgets[selectionDisplayDock] = false; // hidden by default
254
255   // Multi-block inspector
256   QDockWidget* multiBlockInspectorPanelDock  = new QDockWidget( tr( "TTL_MUTLI_BLOCK_INSPECTOR" ), desk );
257   multiBlockInspectorPanelDock->setObjectName("multiBlockInspectorPanelDock");
258   desk->addDockWidget( Qt::LeftDockWidgetArea, multiBlockInspectorPanelDock );
259   pqMultiBlockInspectorPanel* mbi_panel = new pqMultiBlockInspectorPanel( multiBlockInspectorPanelDock );
260   multiBlockInspectorPanelDock->setWidget(mbi_panel);
261   myDockWidgets[multiBlockInspectorPanelDock] = false; // hidden by default
262
263   // Comparative View
264   QDockWidget* comparativePanelDock  = new QDockWidget( tr( "TTL_COMPARATIVE_VIEW_INSPECTOR" ), desk );
265   comparativePanelDock->setObjectName("comparativePanelDock");
266   desk->addDockWidget( Qt::LeftDockWidgetArea, comparativePanelDock );
267   pqComparativeVisPanel* cv_panel = new pqComparativeVisPanel( comparativePanelDock );
268   comparativePanelDock->setWidget(cv_panel);
269   myDockWidgets[comparativePanelDock] = false; // hidden by default
270
271   // Collaboration view
272   QDockWidget* collaborationPanelDock = new QDockWidget(tr( "TTL_COLLABORATIVE_DOCK" ), desk);
273   collaborationPanelDock->setObjectName("collaborationPanelDock");
274   pqCollaborationPanel* collaborationPanel = new pqCollaborationPanel();
275   collaborationPanel->setObjectName("collaborationPanel");
276   collaborationPanelDock->setWidget(collaborationPanel);
277   desk->addDockWidget(Qt::RightDockWidgetArea, collaborationPanelDock);
278   myDockWidgets[collaborationPanelDock] = false; // hidden by default
279
280   // Color map editor
281   QDockWidget* colorMapEditorDock  = new QDockWidget( tr( "TTL_COLOR_MAP_EDITOR" ), desk );
282   colorMapEditorDock->setObjectName("colorMapEditorDock");
283   desk->addDockWidget( Qt::LeftDockWidgetArea, colorMapEditorDock );
284   pqColorMapEditor* cmed_panel = new pqColorMapEditor( colorMapEditorDock );
285   colorMapEditorDock->setWidget(cmed_panel);
286   myDockWidgets[colorMapEditorDock] = false; // hidden by default
287
288   // Provide access to the color-editor panel for the application.
289   pqApplicationCore::instance()->registerManager(
290     "COLOR_EDITOR_PANEL", colorMapEditorDock);
291   
292   // Memory inspector dock
293   QDockWidget* memoryInspectorDock = new QDockWidget(tr( "TTL_MEMORY_INSPECTOR" ), desk);
294   memoryInspectorDock->setObjectName("memoryInspectorDock");
295 #ifndef WIN32
296   pqMemoryInspectorPanel* dockWidgetContents = new pqMemoryInspectorPanel();
297   dockWidgetContents->setObjectName("dockWidgetContents");
298   memoryInspectorDock->setWidget(dockWidgetContents);
299 #endif
300   desk->addDockWidget(Qt::RightDockWidgetArea, memoryInspectorDock);
301   myDockWidgets[memoryInspectorDock] = false; // hidden by default
302
303   // Setup the statusbar ...
304   pqProgressManager* progress_manager =
305     pqApplicationCore::instance()->getProgressManager();
306
307   // Progress bar/button management
308   pqProgressWidget* aProgress = new pqProgressWidget(desk->statusBar());
309   progress_manager->addNonBlockableObject(aProgress);
310   progress_manager->addNonBlockableObject(aProgress->getAbortButton());
311   
312   QObject::connect( progress_manager, SIGNAL(enableProgress(bool)),
313                     aProgress,        SLOT(enableProgress(bool)));
314
315   QObject::connect( progress_manager, SIGNAL(progress(const QString&, int)),
316                     aProgress,        SLOT(setProgress(const QString&, int)));
317
318   QObject::connect( progress_manager, SIGNAL(enableAbort(bool)),
319                     aProgress,        SLOT(enableAbort(bool)));
320
321   QObject::connect( aProgress,        SIGNAL(abortPressed()),
322                     progress_manager, SLOT(triggerAbort()));
323
324   desk->statusBar()->addPermanentWidget(aProgress);
325   aProgress->setEnabled(true);
326
327   // Set up the dock window corners to give the vertical docks more room.
328 //  desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
329 //  desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
330
331   // Setup the default dock configuration ...
332   statisticsViewDock->hide();
333   comparativePanelDock->hide();
334   animationViewDock->hide();
335   multiBlockInspectorPanelDock->hide();
336   selectionDisplayDock->hide();
337   collaborationPanelDock->hide();
338   memoryInspectorDock->hide();
339   colorMapEditorDock->hide();
340 }
341
342 /*!
343   \brief Save states of dockable ParaView widgets.
344 */
345 void PVGUI_Module::saveDockWidgetsState(bool hideWidgets)
346 {
347   SUIT_Desktop* desk = application()->desktop();
348
349   // VSR: 19/06/2011: do not use Paraview's methods, since it conflicts with SALOME GUI architecture
350   // ... the following code is commented...
351   // Save the state of the window ...
352   // pqApplicationCore::instance()->settings()->saveState(*desk, "MainWindow");
353   //
354   //for (int i = 0; i < myDockWidgets.size(); ++i)
355   //  myDockWidgets.at(i)->setParent(0);
356   // ... and replaced - manually hide dock windows
357
358   // store dock widgets visibility state and hide'em all
359   QMapIterator<QWidget*, bool> it1( myDockWidgets );
360   while( it1.hasNext() ) {
361     it1.next();
362     QDockWidget* dw = qobject_cast<QDockWidget*>( it1.key() );
363     myDockWidgets[dw] = dw->isVisible();
364     if ( hideWidgets ) {
365       dw->setVisible( false );
366       dw->toggleViewAction()->setVisible( false );
367     }
368   }
369   // store toolbar breaks state and remove all tollbar breaks 
370   QMapIterator<QWidget*, bool> it2( myToolbarBreaks );
371   while( it2.hasNext() ) {
372     it2.next();
373     QToolBar* tb = qobject_cast<QToolBar*>( it2.key() );
374     myToolbarBreaks[tb] = desk->toolBarBreak( tb );
375     if ( myToolbarBreaks[tb] && hideWidgets )
376       desk->removeToolBarBreak( tb );
377   }
378   // store toolbars visibility state and hide'em all
379   QMapIterator<QWidget*, bool> it3( myToolbars );
380   while( it3.hasNext() ) {
381     it3.next();
382     QToolBar* tb = qobject_cast<QToolBar*>( it3.key() );
383     myToolbars[tb] = tb->isVisible();
384     if ( hideWidgets ) {
385       tb->setVisible( false );
386       tb->toggleViewAction()->setVisible( false );
387     }
388   }
389 }
390
391 /*!
392   \brief Restore states of dockable ParaView widgets.
393 */
394 void PVGUI_Module::restoreDockWidgetsState()
395 {
396   SUIT_Desktop* desk = application()->desktop();
397
398   // VSR: 19/06/2011: do not use Paraview's methods, since it conflicts with SALOME GUI architecture
399   // ... the following code is commented...
400   //for (int i = 0; i < myDockWidgets.size(); ++i)
401   //  myDockWidgets.at(i)->setParent(desk);
402   //
403   // Restore the state of the window ...
404   //pqApplicationCore::instance()->settings()->restoreState("MainWindow", *desk);
405   // ... and replaced - manually hide dock windows
406
407   // restore dock widgets visibility state
408   QMapIterator<QWidget*, bool> it1( myDockWidgets );
409   while( it1.hasNext() ) {
410     it1.next();
411     QDockWidget* dw = qobject_cast<QDockWidget*>( it1.key() );
412     dw->setVisible( it1.value() );
413     dw->toggleViewAction()->setVisible( true );
414   }
415
416   // restore toolbar breaks state
417   QMapIterator<QWidget*, bool> it2( myToolbarBreaks );
418   while( it2.hasNext() ) {
419     it2.next();
420     QToolBar* tb = qobject_cast<QToolBar*>( it2.key() );
421     if ( myToolbarBreaks[tb] )
422       desk->insertToolBarBreak( tb );
423   }
424   
425   // restore toolbar visibility state
426   QMapIterator<QWidget*, bool> it3( myToolbars );
427   while( it3.hasNext() ) {
428     it3.next();
429     QToolBar* tb = qobject_cast<QToolBar*>( it3.key() );
430     tb->setVisible( it3.value() );
431     tb->toggleViewAction()->setVisible( true );
432   }
433 }
434
435
436
437 /*!
438   \brief Store visibility of the common dockable windows (OB, PyConsole, ... etc.)
439 */
440 void PVGUI_Module::storeCommonWindowsState() {  
441   //rnv: Make behaviour of the dockable windows and toolbars coherent with others
442   //     modules: if 'Save position of the windows' or 'Save position of the toolbars' 
443   //     in the General SALOME preferences are cheked, then properties of the windows and/or toolbars
444   //     are stored/restored using standard Qt saveState(...) and restoreState(...) methods.
445   //     Otherwise to the windows and toolbars applied default settins stored int the SalomeApp.xml
446   //     configuration file.
447   //
448   //     But in contrast to others modules ParaVis module default settings hide some dockable
449   //     windows, so to restore it at the moment of the ParaVis de-activation we call 
450   //     restoreCommonWindowsState() method, and at the moment of the ParaVis activation we call 
451   //     this method.
452
453   LightApp_Application* anApp = getApp();
454   if(!anApp)
455     return;
456
457   int begin = LightApp_Application::WT_ObjectBrowser;
458   int end = LightApp_Application::WT_User;
459   for( int i = begin; i <= end; i++ ) {
460     QWidget* wg = anApp->getWindow(i);
461     if(wg) {
462       QDockWidget* dock = 0;
463       QWidget* w = wg->parentWidget();
464       while ( w && !dock ) {
465         dock = ::qobject_cast<QDockWidget*>( w );
466         w = w->parentWidget();
467       }
468       if(dock){
469         if(!myCommonMap.contains(i)){
470           myCommonMap.insert(i,dock->isVisible());
471         } else {
472           myCommonMap[i] = dock->isVisible();
473         }
474       }
475     }
476   }
477 }
478
479 /*!
480   \brief Restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
481 */
482 void PVGUI_Module::restoreCommonWindowsState() {
483   LightApp_Application* anApp = getApp();
484   if(!anApp)
485     return;
486   DockWindowMap::const_iterator it = myCommonMap.begin();
487   for( ;it != myCommonMap.end(); it++ ) {
488     QWidget* wg = anApp->getWindow(it.key());
489     if(wg) {
490       QDockWidget* dock = 0;
491       QWidget* w = wg->parentWidget();
492       while ( w && !dock ) {
493         dock = ::qobject_cast<QDockWidget*>( w );
494         w = w->parentWidget();
495       }
496       if(dock) {
497         dock->setVisible(it.value());
498       }
499     }
500   }
501 }