From: vsr Date: Tue, 12 Aug 2014 06:19:53 +0000 (+0400) Subject: 0022614: [CEA 1146] SalomePyQt python API tabifyDockWidgets and findDockByWT X-Git-Tag: V7_5_0a1~23 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=14f89d63e08796870dd6f0141d99276214403b55;p=modules%2Fgui.git 0022614: [CEA 1146] SalomePyQt python API tabifyDockWidgets and findDockByWT Give explicit names to standard dock windows --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 66ff3fba1..9653a7be3 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -1172,74 +1172,6 @@ void LightApp_Application::onSelectionChanged() action( EditPasteId )->setEnabled(canPaste); } -/*! - Adds window to application. - \param wid - QWidget - \param flag - key for window - \param studyId - study id - Flag used how identificator of window in windows list. -*/ -/* -void LightApp_Application::addWindow( QWidget* wid, const int flag, const int studyId ) -{ - if ( !wid ) - return; - - int sId = studyId; - if ( sId < 0 ) - { - if ( !activeStudy() ) - return; - else - sId = activeStudy()->id(); - } - - if ( !myWindows.contains( flag ) ) - { - QMap winMap; - currentWindows( winMap ); - - LightApp_WidgetContainer* newWC = new LightApp_WidgetContainer( flag, desktop() ); - connect( newWC, SIGNAL( destroyed ( QObject* ) ), this, SLOT( onWCDestroyed( QObject* ) ) ); - // asv: connecting a slot for storing visibility flag of a window - connect( newWC, SIGNAL( visibilityChanged ( bool ) ), SLOT( onVisibilityChanged( bool ) ) ); - myWindows.insert( flag, newWC ); - if ( winMap.contains( flag ) ) { - //desktop()->removeDockWidget( myWindows[flag] ); - desktop()->addDockWidget( (Qt::DockWidgetArea)winMap[flag], myWindows[flag] ); - } - - //myWindows[flag]->setResizeEnabled( true ); - myWindows[flag]->setFeatures( QDockWidget::AllDockWidgetFeatures ); - myWindows[flag]->setObjectName( QString( "dock_window_%1" ).arg( flag ) ); - //myWindows[flag]->setFixedExtentWidth( wid->width() ); - //myWindows[flag]->setFixedExtentHeight( wid->height() ); - myWindows[flag]->resize( wid->width(), wid->height() ); - } - - QFont f; -#ifndef DISABLE_PYCONSOLE - if( wid->inherits( "PyConsole_Console" ) ) - { - if( resourceMgr()->hasValue( "PyConsole", "font" ) ) - f = resourceMgr()->fontValue( "PyConsole", "font" ); - else - { - f = ( ( PyConsole_Console* )wid )->font(); - resourceMgr()->setValue( "PyConsole", "font", f ); - } - } - else -#endif - f = wid->font(); - - myWindows[flag]->insert( sId, wid ); - wid->setFont( f ); - - setWindowShown( flag, !myWindows[flag]->isEmpty() ); -} -*/ - QWidget* LightApp_Application::dockWindow( const int id ) const { QWidget* wid = 0; @@ -1277,7 +1209,8 @@ void LightApp_Application::insertDockWindow( const int id, QWidget* wid ) connect( dock, SIGNAL( destroyed( QObject* ) ), this, SLOT( onWCDestroyed( QObject* ) ) ); dock->setFeatures( QDockWidget::AllDockWidgetFeatures ); - dock->setObjectName( QString( "window_%1" ).arg( id ) ); + dock->setObjectName( wid->objectName().isEmpty() ? QString( "window_%1" ).arg( id ) : + QString( "%1Dock" ).arg( wid->objectName() ) ); dock->setWidget( wid ); QKeySequence accel = wid->property( "shortcut" ).value(); @@ -1901,6 +1834,7 @@ QWidget* LightApp_Application::createWindow( const int flag ) if ( flag == WT_ObjectBrowser ) { SUIT_DataBrowser* ob = new SUIT_DataBrowser( new LightApp_DataObject(), desktop() ); + ob->setObjectName( "objectBrowser" ); ob->setSortMenuEnabled( true ); ob->setAutoUpdate( true ); if ( resMgr->hasValue( "ObjectBrowser", "auto_hide_search_tool" ) ) @@ -1944,6 +1878,7 @@ QWidget* LightApp_Application::createWindow( const int flag ) else if ( flag == WT_PyConsole ) { PyConsole_Console* pyCons = new PyConsole_EnhConsole( desktop(),new LightApp_PyInterp()); + pyCons->setObjectName( "pythonConsole" ); pyCons->setWindowTitle( tr( "PYTHON_CONSOLE" ) ); pyCons->setFont(resourceMgr()->fontValue( "PyConsole", "font" )); pyCons->setIsShowBanner(resourceMgr()->booleanValue( "PyConsole", "show_banner", true )); @@ -1956,6 +1891,7 @@ QWidget* LightApp_Application::createWindow( const int flag ) else if ( flag == WT_LogWindow ) { LogWindow* logWin = new LogWindow( desktop() ); + logWin->setObjectName( "logWindow" ); logWin->setWindowTitle( tr( "LOG_WINDOW" ) ); logWin->setProperty( "shortcut", QKeySequence( "Alt+Shift+L" ) ); wid = logWin; diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 4182bfcb1..08488ab3a 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -1067,6 +1067,7 @@ QWidget* SalomeApp_Application::createWindow( const int flag ) else if ( flag == WT_PyConsole ) { PyConsole_Console* pyCons = new PyConsole_EnhConsole( desktop(), new SalomeApp_PyInterp() ); + pyCons->setObjectName( "pythonConsole" ); pyCons->setWindowTitle( tr( "PYTHON_CONSOLE" ) ); pyCons->setFont(resourceMgr()->fontValue( "PyConsole", "font" )); pyCons->setIsShowBanner(resourceMgr()->booleanValue( "PyConsole", "show_banner", true )); @@ -1086,6 +1087,7 @@ QWidget* SalomeApp_Application::createWindow( const int flag ) getNoteBook(), SLOT( onVarUpdate( QString ) ) ); } wid = getNoteBook(); + wid->setObjectName( "noteBook" ); } #endif return wid;