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