From 9a95c556de777b9acdc4b413d2bcecacc0d718b6 Mon Sep 17 00:00:00 2001 From: vsr Date: Thu, 28 Aug 2014 11:20:42 +0400 Subject: [PATCH] 0022673: [CEA 1260] Regression : opening a new study hides the modules toolbar --- src/LightApp/LightApp_Application.cxx | 12 +++++++++--- src/LightApp/LightApp_Application.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 1a8cb150d..575039445 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -3266,6 +3266,10 @@ void LightApp_Application::loadDockWindowsState() desktop()->restoreState( aTargetArray ); } + QStringList mainToolbarsNames; + mainToolbarsNames << "SalomeStandard" << "SalomeModules"; + QList 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 LightApp_Application::findToolBars() { +QList LightApp_Application::findToolBars( const QStringList& names ) +{ QList aResult; QList tbList = qFindChildren( desktop() ); for ( QList::iterator tit = tbList.begin(); tit != tbList.end(); ++tit ) { @@ -4140,7 +4145,8 @@ QList 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) { diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index 598371345..3e43869f4 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -297,7 +297,7 @@ protected: private: void emptyPreferences( const QString& ); - QList findToolBars(); + QList findToolBars( const QStringList& names = QStringList() ); QByteArray processState(QByteArray& input, const bool processWin, -- 2.39.2