Salome HOME
0022673: [CEA 1260] Regression : opening a new study hides the modules toolbar
authorvsr <vsr@opencascade.com>
Thu, 28 Aug 2014 07:20:42 +0000 (11:20 +0400)
committervsr <vsr@opencascade.com>
Thu, 28 Aug 2014 07:20:42 +0000 (11:20 +0400)
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h

index 1a8cb150d3d6aee36f6e33efd399bec0d1eeba0c..575039445e162fd8a119248f66cd51248e22c356 100644 (file)
@@ -3266,6 +3266,10 @@ void LightApp_Application::loadDockWindowsState()
     desktop()->restoreState( aTargetArray );
   }
 
+  QStringList mainToolbarsNames;
+  mainToolbarsNames << "SalomeStandard" << "SalomeModules";
+  QList<QToolBar*> mainToolbars = findToolBars( mainToolbarsNames );
+  foreach( QToolBar* tb, mainToolbars ) tb->setVisible( true );
   /*
   if ( !myWinVis.contains( modName ) && aDefaultVisibility.isEmpty())
     return;
@@ -4132,7 +4136,8 @@ void LightApp_Application::onDesktopMessage( const QString& message )
   Returns all top level toolbars.
   Note : Result list contains only main window toolbars, not including toolbars from viewers.
 */
-QList<QToolBar*> LightApp_Application::findToolBars() {
+QList<QToolBar*> LightApp_Application::findToolBars( const QStringList& names )
+{
   QList<QToolBar*> aResult;
   QList<QToolBar*> tbList = qFindChildren<QToolBar*>( desktop() );
   for ( QList<QToolBar*>::iterator tit = tbList.begin(); tit != tbList.end(); ++tit ) {
@@ -4140,7 +4145,8 @@ QList<QToolBar*> LightApp_Application::findToolBars() {
     QObject* po = Qtx::findParent( tb, "QMainWindow" );
     if ( po != desktop() )
       continue;        
-    aResult.append(tb);
+    if ( names.isEmpty() || names.contains( tb->objectName() ) )
+      aResult.append(tb);
   }
   return aResult;
 }
@@ -4184,9 +4190,9 @@ QByteArray LightApp_Application::processState(QByteArray& input,
     }
 
     int toolBarMarkerIndex = getToolbarMarkerIndex(input,aNames);
-    QDataStream anInputData(&input, QIODevice::ReadOnly);
     if(toolBarMarkerIndex < 0)
       return aRes;
+    QDataStream anInputData(&input, QIODevice::ReadOnly);
 
     int toolBarMarkerIndexDef;
     if(hasDefaultState) {
index 59837134589b750e26fab198d2cb2e99ed056466..3e43869f4defdd53be0815de85ba0b128d06cb3a 100644 (file)
@@ -297,7 +297,7 @@ protected:
 
 private:
   void                                emptyPreferences( const QString& );
-  QList<QToolBar*>                    findToolBars();
+  QList<QToolBar*>                    findToolBars( const QStringList& names = QStringList() );
   
   QByteArray                          processState(QByteArray& input, 
                                                   const bool processWin,