1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File: LightApp_Module.cxx
24 // Created: 6/20/2005 16:30:56 AM
27 #include "LightApp_Module.h"
29 #include "CAM_Application.h"
31 #include "LightApp_Application.h"
32 #include "LightApp_DataModel.h"
33 #include "LightApp_DataObject.h"
34 #include "LightApp_Study.h"
35 #include "LightApp_Preferences.h"
36 #include "LightApp_Selection.h"
37 #include "LightApp_Operation.h"
38 #include "LightApp_SwitchOp.h"
39 #include "LightApp_UpdateFlags.h"
40 #include "LightApp_ShowHideOp.h"
41 #include "LightApp_SelectionMgr.h"
43 #include <SUIT_Study.h>
44 #include <SUIT_DataObject.h>
45 #include <SUIT_DataBrowser.h>
46 #include <SUIT_Operation.h>
47 #include <SUIT_ViewManager.h>
48 #include <SUIT_ResourceMgr.h>
49 #include <SUIT_ShortcutMgr.h>
50 #include <SUIT_Desktop.h>
51 #include <SUIT_TreeModel.h>
52 #include <SUIT_Session.h>
54 #ifndef DISABLE_SALOMEOBJECT
55 #include <SALOME_ListIO.hxx>
58 #ifndef DISABLE_VTKVIEWER
59 #ifndef DISABLE_SALOMEOBJECT
60 #include <SVTK_ViewWindow.h>
61 #include <SVTK_ViewModel.h>
63 #include <VTKViewer_ViewWindow.h>
65 #include <VTKViewer_ViewModel.h>
67 #ifndef DISABLE_OCCVIEWER
68 #include <OCCViewer_ViewWindow.h>
69 #include <OCCViewer_ViewPort3d.h>
70 #ifndef DISABLE_SALOMEOBJECT
71 #include <SOCC_ViewModel.h>
73 #include <OCCViewer_ViewModel.h>
76 #ifndef DISABLE_GLVIEWER
77 #include <GLViewer_ViewFrame.h>
78 #include <GLViewer_ViewPort.h>
80 #ifndef DISABLE_PVVIEWER
81 #include <PVViewer_ViewManager.h>
82 #include <PVViewer_ViewWindow.h>
84 #ifndef DISABLE_PLOT2DVIEWER
85 #include <Plot2d_ViewWindow.h>
86 #include <Plot2d_ViewFrame.h>
87 #ifndef DISABLE_SALOMEOBJECT
88 #include <SPlot2d_ViewModel.h>
90 #include <Plot2d_ViewModel.h>
94 #include <QtxPopupMgr.h>
98 #include <QStringList>
104 LightApp_Module::LightApp_Module( const QString& name )
105 : CAM_Module( name ),
112 myIsFirstActivate( true )
117 LightApp_Module::~LightApp_Module()
123 /*!Initialize module.*/
124 void LightApp_Module::initialize( CAM_Application* app )
126 CAM_Module::initialize( app );
128 SUIT_ResourceMgr* resMgr = app ? app->resourceMgr() : 0;
130 resMgr->raiseTranslators( name() );
134 void LightApp_Module::windows( QMap<int, int>& ) const
139 void LightApp_Module::viewManagers( QStringList& ) const
143 /*!Context menu popup.*/
144 void LightApp_Module::contextMenuPopup( const QString& client, QMenu* menu, QString& /*title*/ )
146 LightApp_Selection* sel = createSelection();
147 sel->init( client, getApp()->selectionMgr() );
149 popupMgr()->setSelection( sel );
150 popupMgr()->setMenu( menu );
151 popupMgr()->updateMenu();
154 /*!Update object browser.
155 * For updating model or whole object browser use update() method can be used.
157 void LightApp_Module::updateObjBrowser( bool theIsUpdateDataModel,
158 SUIT_DataObject* theDataObject )
160 bool upd = getApp()->objectBrowser()->autoUpdate();
161 getApp()->objectBrowser()->setAutoUpdate( false );
163 if( theIsUpdateDataModel ){
164 if( CAM_DataModel* aDataModel = dataModel() ){
165 if ( LightApp_DataModel* aModel = dynamic_cast<LightApp_DataModel*>( aDataModel ) ) {
166 //SUIT_DataObject* aParent = NULL;
167 //if(theDataObject && theDataObject != aDataModel->root())
168 // aParent = theDataObject->parent();
170 LightApp_DataObject* anObject = dynamic_cast<LightApp_DataObject*>(theDataObject);
171 LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>(getApp()->activeStudy());
172 aModel->update( anObject, aStudy );
177 getApp()->objectBrowser()->setAutoUpdate( upd );
178 getApp()->objectBrowser()->updateTree( 0, false );
182 void LightApp_Module::selectionChanged()
186 /*! \brief If return false, selection will be cleared at module activation
188 bool LightApp_Module::isSelectionCompatible()
190 // return true if selected objects belong to this module
191 bool isCompatible = true;
192 #ifndef DISABLE_SALOMEOBJECT
193 SALOME_ListIO selected;
194 if ( LightApp_SelectionMgr *Sel = getApp()->selectionMgr() )
195 Sel->selectedObjects( selected );
197 LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( getApp()->activeStudy() );
198 LightApp_DataObject* aRoot = dynamic_cast<LightApp_DataObject*>( dataModel()->root() );
199 if ( aStudy && aRoot ) {
201 QString moduleDataType = aRoot->componentDataType();
202 // check data type of selection
203 SALOME_ListIteratorOfListIO It( selected );
204 for ( ; isCompatible && It.More(); It.Next()) {
205 Handle(SALOME_InteractiveObject) io = It.Value();
206 isCompatible = ( aStudy->componentDataType( io->getEntry() ) == moduleDataType );
213 /*!Activate module.*/
214 bool LightApp_Module::activateModule( SUIT_Study* study )
216 bool res = CAM_Module::activateModule( study );
218 if ( !isSelectionCompatible() )// PAL19290, PAL18352
219 getApp()->selectionMgr()->clearSelected();
221 if ( res && application() && application()->resourceMgr() )
222 application()->resourceMgr()->raiseTranslators( name() );
224 connect( application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
225 this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
226 connect( application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
227 this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
229 if ( mySwitchOp == 0 )
230 mySwitchOp = new LightApp_SwitchOp( this );
232 // Enable Display and Erase actions
233 if ( action(myDisplay) )
234 action(myDisplay)->setEnabled(true);
235 if ( action(myErase) )
236 action(myErase)->setEnabled(true);
238 application()->shortcutMgr()->setSectionEnabled( moduleName() );
240 /* BUG 0020498 : The Entry column is always shown at module activation
241 The registration of column is moved into LightApp_Application
243 QString EntryCol = QObject::tr( "ENTRY_COLUMN" );
244 LightApp_DataModel* m = dynamic_cast<LightApp_DataModel*>( dataModel() );
247 SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( getApp()->objectBrowser()->model() );
248 m->registerColumn( getApp()->objectBrowser(), EntryCol, LightApp_DataObject::EntryId );
249 treeModel->setAppropriate( EntryCol, Qtx::Toggled );
255 /*!Deactivate module.*/
256 bool LightApp_Module::deactivateModule( SUIT_Study* study )
261 disconnect( application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
262 this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
263 disconnect( application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
264 this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
266 // abort all operations
267 MapOfOperation::const_iterator anIt;
268 for( anIt = myOperations.begin(); anIt != myOperations.end(); anIt++ ) {
269 anIt.value()->abort();
272 // Disable Display and Erase action
273 if ( action(myDisplay) )
274 action(myDisplay)->setEnabled(false);
275 if ( action(myErase) )
276 action(myErase)->setEnabled(false);
278 application()->shortcutMgr()->setSectionEnabled( moduleName(), false );
280 /* BUG 0020498 : The Entry column is always shown at module activation
281 QString EntryCol = QObject::tr( "ENTRY_COLUMN" );
282 LightApp_DataModel* m = dynamic_cast<LightApp_DataModel*>( dataModel() );
285 SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( getApp()->objectBrowser()->model() );
287 treeModel->setAppropriate( EntryCol, Qtx::Shown );
288 m->unregisterColumn( getApp()->objectBrowser(), EntryCol );
291 return CAM_Module::deactivateModule( study );
294 /*! Redefined to reset internal flags valid for study instance */
295 void LightApp_Module::studyClosed( SUIT_Study* theStudy )
297 CAM_Module::studyClosed( theStudy );
299 myIsFirstActivate = true;
301 LightApp_Application* app = dynamic_cast<LightApp_Application*>(application());
303 SUIT_DataBrowser* ob = app->objectBrowser();
304 if ( ob && ob->model() )
305 disconnect( ob->model(), SIGNAL( clicked( SUIT_DataObject*, int ) ),
306 this, SLOT( onObjectClicked( SUIT_DataObject*, int ) ) );
311 void LightApp_Module::MenuItem()
316 void LightApp_Module::createPreferences()
321 void LightApp_Module::preferencesChanged( const QString&, const QString& )
326 void LightApp_Module::message( const QString& )
330 /*!Gets application.*/
331 LightApp_Application* LightApp_Module::getApp() const
333 return (LightApp_Application*)application();
337 * \brief Update something in accordance with update flags
338 * \param theFlags - update flags
340 * Update viewer or/and object browser etc. in accordance with update flags ( see
341 * LightApp_UpdateFlags enumeration ). Derived modules can redefine this method for their
344 void LightApp_Module::update( const int theFlags )
346 if ( theFlags & UF_Model )
348 if( CAM_DataModel* aDataModel = dataModel() )
349 if( LightApp_DataModel* aModel = dynamic_cast<LightApp_DataModel*>( aDataModel ) )
350 aModel->update( 0, dynamic_cast<LightApp_Study*>( getApp()->activeStudy() ) );
353 if ( theFlags & UF_ObjBrowser )
354 getApp()->objectBrowser()->updateTree( 0 );
356 if ( theFlags & UF_Controls )
358 if ( theFlags & UF_Viewer )
360 if ( SUIT_ViewManager* viewMgr = getApp()->activeViewManager() )
361 if ( SUIT_ViewWindow* viewWnd = viewMgr->getActiveView() )
363 #ifndef DISABLE_VTKVIEWER
364 #ifndef DISABLE_SALOMEOBJECT
365 if ( viewWnd->inherits( "SVTK_ViewWindow" ) )
366 ( (SVTK_ViewWindow*)viewWnd )->Repaint();
368 if ( viewWnd->inherits( "VTKViewer_ViewWindow" ) )
369 ( (VTKViewer_ViewWindow*)viewWnd )->Repaint();
372 #ifndef DISABLE_OCCVIEWER
373 if ( viewWnd->inherits( "OCCViewer_ViewWindow" ) )
374 ( (OCCViewer_ViewWindow*)viewWnd )->getViewPort()->onUpdate();
376 #ifndef DISABLE_PLOT2DVIEWER
377 if ( viewWnd->inherits( "Plot2d_ViewWindow" ) )
378 ( (Plot2d_ViewWindow*)viewWnd )->getViewFrame()->Repaint();
380 #ifndef DISABLE_GLVIEWER
381 if ( viewWnd->inherits( "GLViewer_ViewFrame" ) )
382 ( (GLViewer_ViewFrame*)viewWnd )->getViewPort()->onUpdate();
384 #ifndef DISABLE_PVVIEWER
385 // if ( viewWnd->inherits( "PVViewer_ViewWindow" ) )
386 // ( (PVViewer_ViewWindow*)viewWnd )->getViewPort()->onUpdate();
392 * \brief Updates controls
394 * Updates (i.e. disable/enable) controls states (menus, tool bars etc.). This method is
395 * called from update( UF_Controls ). You may redefine it in concrete module.
397 void LightApp_Module::updateControls()
401 /*!Create new instance of data model and return it.*/
402 CAM_DataModel* LightApp_Module::createDataModel()
404 return new LightApp_DataModel( this );
407 /*!Create and return instance of LightApp_Selection.*/
408 LightApp_Selection* LightApp_Module::createSelection() const
410 return new LightApp_Selection();
414 void LightApp_Module::onModelOpened()
419 void LightApp_Module::onModelSaved()
424 void LightApp_Module::onModelClosed()
428 /*!Gets popup manager.(create if not exist)*/
429 QtxPopupMgr* LightApp_Module::popupMgr()
433 myPopupMgr = new QtxPopupMgr( 0, this );
436 SUIT_Desktop* d = application()->desktop();
439 *disp = createAction( -1, tr( "TOP_SHOW" ), p, tr( "MEN_SHOW" ), tr( "STB_SHOW" ),
440 0, d, false, this, SLOT( onShowHide() ), QString("General:Show object(s)") ),
441 *erase = createAction( -1, tr( "TOP_HIDE" ), p, tr( "MEN_HIDE" ), tr( "STB_HIDE" ),
442 0, d, false, this, SLOT( onShowHide() ) , QString("General:Hide object(s)") ),
443 *dispOnly = createAction( -1, tr( "TOP_DISPLAY_ONLY" ), p, tr( "MEN_DISPLAY_ONLY" ), tr( "STB_DISPLAY_ONLY" ),
444 0, d, false, this, SLOT( onShowHide() ) ),
445 *eraseAll = createAction( -1, tr( "TOP_ERASE_ALL" ), p, tr( "MEN_ERASE_ALL" ), tr( "STB_ERASE_ALL" ),
446 0, d, false, this, SLOT( onShowHide() ) );
447 myDisplay = actionId( disp );
448 myErase = actionId( erase );
449 myDisplayOnly = actionId( dispOnly );
450 myEraseAll = actionId( eraseAll );
452 myPopupMgr->insert( disp, -1, 0 );
453 myPopupMgr->insert( erase, -1, 0 );
454 myPopupMgr->insert( dispOnly, -1, 0 );
455 myPopupMgr->insert( eraseAll, -1, 0 );
456 myPopupMgr->insert( separator(), -1, 0 );
458 QString oneAndNotActive = "( count( $component ) = 1 ) and ( not( activeModule in $component ) )";
459 QString uniform = "true in $canBeDisplayed and %1 and ( activeModule = '%2' )";
460 uniform = uniform.arg( oneAndNotActive ).arg( name() );
461 myPopupMgr->setRule( disp, /*QString( "( not isVisible ) and " ) + */ uniform, QtxPopupMgr::VisibleRule );
462 myPopupMgr->setRule( erase, /*QString( "( isVisible ) and " ) + */ uniform, QtxPopupMgr::VisibleRule );
463 myPopupMgr->setRule( dispOnly, uniform, QtxPopupMgr::VisibleRule );
467 #ifndef DISABLE_OCCVIEWER
468 #ifndef DISABLE_SALOMEOBJECT
469 viewers.append( SOCC_Viewer::Type() );
471 viewers.append( OCCViewer_Viewer::Type() );
474 #ifndef DISABLE_VTKVIEWER
475 #ifndef DISABLE_SALOMEOBJECT
476 viewers.append( SVTK_Viewer::Type() );
478 viewers.append( VTKViewer_Viewer::Type() );
481 #ifndef DISABLE_PLOT2DVIEWER
482 #ifndef DISABLE_SALOMEOBJECT
483 viewers.append( SPlot2d_Viewer::Type() );
485 viewers.append( Plot2d_Viewer::Type() );
489 if( !viewers.isEmpty() )
491 QString strViewers = "{ ", temp = "'%1' ";
492 QStringList::const_iterator anIt = viewers.begin(), aLast = viewers.end();
493 for( ; anIt!=aLast; anIt++ )
494 strViewers+=temp.arg( *anIt );
496 myPopupMgr->setRule( eraseAll, QString( "client in %1" ).arg( strViewers ), QtxPopupMgr::VisibleRule );
502 /*!Gets preferences.*/
503 LightApp_Preferences* LightApp_Module::preferences() const
505 LightApp_Preferences* pref = 0;
507 pref = getApp()->preferences();
511 /*!Add preference to preferences.*/
512 int LightApp_Module::addPreference( const QString& label )
514 LightApp_Preferences* pref = preferences();
518 int catId = pref->addPreference( moduleName(), -1 );
522 return pref->addPreference( label, catId );
525 /*!Add preference to preferences.*/
526 int LightApp_Module::addPreference( const QString& label, const int pId, const int type,
527 const QString& section, const QString& param )
529 LightApp_Preferences* pref = preferences();
533 return pref->addPreference( moduleName(), label, pId, type, section, param );
536 /*!Gets property of preferences.*/
537 QVariant LightApp_Module::preferenceProperty( const int id, const QString& prop ) const
540 LightApp_Preferences* pref = preferences();
542 var = pref->itemProperty( prop, id );
546 /*!Set property of preferences.*/
547 void LightApp_Module::setPreferenceProperty( const int id, const QString& prop, const QVariant& var )
549 LightApp_Preferences* pref = preferences();
551 pref->setItemProperty( prop, var, id );
555 * \brief Starts operation with given identifier
556 * \param id - identifier of operation to be started
558 * Module stores operations in map. This method starts operation by id.
559 * If operation isn't in map, then it will be created by createOperation method
560 * and will be inserted to map
562 void LightApp_Module::startOperation( const int id )
564 LightApp_Operation* op = 0;
565 if( myOperations.contains( id ) && reusableOperation( id ) )
566 op = myOperations[ id ];
569 op = createOperation( id );
572 myOperations.insert( id, op );
573 op->setModule( this );
574 connect( op, SIGNAL( stopped( SUIT_Operation* ) ), this, SLOT( onOperationStopped( SUIT_Operation* ) ) );
575 connect( op, SIGNAL( destroyed() ), this, SLOT( onOperationDestroyed() ) );
581 // be sure that operation has correct study pointer
582 op->setStudy( application() ? application()->activeStudy() : 0 );
588 * \brief Creates operation with given identifier
589 * \param id - identifier of operation to be started
590 * \return Pointer on created operation or NULL if operation is not created
592 * Creates operation with given id. You should not call this method, it will be called
593 * automatically from startOperation. You may redefine this method in concrete module to
596 LightApp_Operation* LightApp_Module::createOperation( const int id ) const
602 return new LightApp_ShowHideOp( LightApp_ShowHideOp::DISPLAY );
603 else if( id==myErase )
604 return new LightApp_ShowHideOp( LightApp_ShowHideOp::ERASE );
605 else if( id==myDisplayOnly )
606 return new LightApp_ShowHideOp( LightApp_ShowHideOp::DISPLAY_ONLY );
607 else if( id==myEraseAll )
608 return new LightApp_ShowHideOp( LightApp_ShowHideOp::ERASE_ALL );
614 * \brief Virtual protected slot called when operation stopped
615 * \param theOp - stopped operation
617 * Virtual protected slot called when operation stopped. Redefine this slot if you want to
618 * perform actions after stopping operation
620 void LightApp_Module::onOperationStopped( SUIT_Operation* /*theOp*/ )
625 * \brief Virtual protected slot called when operation destroyed
626 * \param theOp - destroyed operation
628 * Virtual protected slot called when operation destroyed. Redefine this slot if you want to
629 * perform actions after destroying operation. Base implementation removes pointer on
630 * destroyed operation from the map of operations
632 void LightApp_Module::onOperationDestroyed()
634 const QObject* s = sender();
635 if( s && s->inherits( "LightApp_Operation" ) )
637 const LightApp_Operation* op = ( LightApp_Operation* )s;
638 MapOfOperation::const_iterator anIt = myOperations.begin(),
639 aLast = myOperations.end();
640 for( ; anIt!=aLast; anIt++ )
641 if( anIt.value()==op )
643 myOperations.remove( anIt.key() );
650 Must be redefined in order to use standard displayer mechanism
651 \return displayer of module
653 LightApp_Displayer* LightApp_Module::displayer()
659 SLOT: called on activating of standard operations show/hide
661 void LightApp_Module::onShowHide()
663 if( !sender()->inherits( "QAction" ) || !popupMgr() )
666 QAction* act = ( QAction* )sender();
667 int id = actionId( act );
669 startOperation( id );
673 virtual SLOT: called on view manager adding
675 void LightApp_Module::onViewManagerAdded( SUIT_ViewManager* )
680 virtual SLOT: called on view manager removing
682 void LightApp_Module::onViewManagerRemoved( SUIT_ViewManager* )
687 \brief Returns instance of operation by its id; if there is no operation
688 corresponding to this id, null pointer is returned
689 \param id - operation id
690 \return operation instance
692 LightApp_Operation* LightApp_Module::operation( const int id ) const
694 return myOperations.contains( id ) ? myOperations[id] : 0;
698 virtual method called to manage the same operations
700 bool LightApp_Module::reusableOperation( const int id )
707 \return true if module can copy the current selection
709 bool LightApp_Module::canCopy() const
716 \return true if module can paste previously copied data
718 bool LightApp_Module::canPaste() const
725 \brief Copies the current selection into clipboard
727 void LightApp_Module::copy()
733 \brief Pastes the current data in the clipboard
735 void LightApp_Module::paste()
741 \return true if module allows dragging the given object
743 bool LightApp_Module::isDraggable( const SUIT_DataObject* /*what*/ ) const
750 \return true if module allows dropping one or more objects (currently selected) on the object \c where
752 bool LightApp_Module::isDropAccepted( const SUIT_DataObject* /*where*/ ) const
759 Complete drag-n-drop operation by processing objects \a what being dragged, dropped to the line \a row
760 within the object \a where. The drop action being performed is specified by \a action.
762 void LightApp_Module::dropObjects( const DataObjectList& /*what*/, SUIT_DataObject* /*where*/,
763 const int /*row*/, Qt::DropAction /*action*/ )
768 \brief Return \c true if object can be renamed
770 bool LightApp_Module::renameAllowed( const QString& /*entry*/ ) const
776 Rename object by entry.
777 \param entry entry of the object
778 \param name new name of the object
779 \brief Return \c true if rename operation finished successfully, \c false otherwise.
781 bool LightApp_Module::renameObject( const QString& /*entry*/, const QString& /*name*/ )
787 Update visibility state for data objects
789 void LightApp_Module::updateModuleVisibilityState()
791 // update visibility state of objects
792 LightApp_Application* app = dynamic_cast<LightApp_Application*>(SUIT_Session::session()->activeApplication());
795 SUIT_DataBrowser* ob = app->objectBrowser();
796 if ( !ob || !ob->model() ) return;
798 if ( !myIsFirstActivate )
801 myIsFirstActivate = false;
803 // connect to click on item
804 connect( ob->model(), SIGNAL( clicked( SUIT_DataObject*, int ) ),
805 this, SLOT( onObjectClicked( SUIT_DataObject*, int ) ), Qt::UniqueConnection );
806 // connect to click on item
807 connect( ob, SIGNAL( destroyed( QObject* ) ),
808 this, SLOT( onOBDestroyed() ), Qt::UniqueConnection );
810 SUIT_DataObject* rootObj = ob->root();
811 if ( !rootObj ) return;
813 DataObjectList listObj = rootObj->children( true );
815 SUIT_ViewModel* vmod = 0;
816 if ( SUIT_ViewManager* vman = app->activeViewManager() )
817 vmod = vman->getViewModel();
818 app->updateVisibilityState( listObj, vmod );
822 * \brief Virtual public slot
824 * This method is called after the object inserted into data view to update their visibility state
825 * This is default implementation
827 void LightApp_Module::onObjectClicked( SUIT_DataObject* theObject, int theColumn )
829 if ( !isActiveModule() ) return;
831 // change visibility of object
832 if ( !theObject || theColumn != SUIT_DataObject::VisibilityId ) return;
834 LightApp_Study* study = dynamic_cast<LightApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
835 if ( !study ) return;
837 LightApp_DataObject* lo = dynamic_cast<LightApp_DataObject*>( theObject );
840 // detect action index (from LightApp level)
843 if ( study->visibilityState( lo->entry() ) == Qtx::ShownState )
845 else if ( study->visibilityState( lo->entry() ) == Qtx::HiddenState )
849 startOperation( id );
852 void LightApp_Module::onOBDestroyed()
854 myIsFirstActivate = true;