1 // Copyright (C) 2007-2014 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>
56 #include <SALOME_ListIteratorOfListIO.hxx>
59 #ifndef DISABLE_VTKVIEWER
60 #ifndef DISABLE_SALOMEOBJECT
61 #include <SVTK_ViewWindow.h>
62 #include <SVTK_ViewModel.h>
64 #include <VTKViewer_ViewWindow.h>
66 #include <VTKViewer_ViewModel.h>
68 #ifndef DISABLE_OCCVIEWER
69 #include <OCCViewer_ViewWindow.h>
70 #include <OCCViewer_ViewPort3d.h>
71 #ifndef DISABLE_SALOMEOBJECT
72 #include <SOCC_ViewModel.h>
74 #include <OCCViewer_ViewModel.h>
77 #ifndef DISABLE_GLVIEWER
78 #include <GLViewer_ViewFrame.h>
79 #include <GLViewer_ViewPort.h>
81 #ifndef DISABLE_PVVIEWER
82 #include <PVViewer_ViewManager.h>
83 #include <PVViewer_ViewWindow.h>
85 #ifndef DISABLE_PLOT2DVIEWER
86 #include <Plot2d_ViewWindow.h>
87 #include <Plot2d_ViewFrame.h>
88 #ifndef DISABLE_SALOMEOBJECT
89 #include <SPlot2d_ViewModel.h>
91 #include <Plot2d_ViewModel.h>
95 #include <QtxPopupMgr.h>
99 #include <QStringList>
105 LightApp_Module::LightApp_Module( const QString& name )
106 : CAM_Module( name ),
113 myIsFirstActivate( true )
118 LightApp_Module::~LightApp_Module()
124 /*!Initialize module.*/
125 void LightApp_Module::initialize( CAM_Application* app )
127 CAM_Module::initialize( app );
129 SUIT_ResourceMgr* resMgr = app ? app->resourceMgr() : 0;
131 resMgr->raiseTranslators( name() );
135 void LightApp_Module::windows( QMap<int, int>& ) const
140 void LightApp_Module::viewManagers( QStringList& ) const
144 /*!Context menu popup.*/
145 void LightApp_Module::contextMenuPopup( const QString& client, QMenu* menu, QString& /*title*/ )
147 LightApp_Selection* sel = createSelection();
148 sel->init( client, getApp()->selectionMgr() );
150 popupMgr()->setSelection( sel );
151 popupMgr()->setMenu( menu );
152 popupMgr()->updateMenu();
155 /*!Update object browser.
156 * For updating model or whole object browser use update() method can be used.
158 void LightApp_Module::updateObjBrowser( bool theIsUpdateDataModel,
159 SUIT_DataObject* theDataObject )
161 bool upd = getApp()->objectBrowser()->autoUpdate();
162 getApp()->objectBrowser()->setAutoUpdate( false );
164 if( theIsUpdateDataModel ){
165 if( CAM_DataModel* aDataModel = dataModel() ){
166 if ( LightApp_DataModel* aModel = dynamic_cast<LightApp_DataModel*>( aDataModel ) ) {
167 //SUIT_DataObject* aParent = NULL;
168 //if(theDataObject && theDataObject != aDataModel->root())
169 // aParent = theDataObject->parent();
171 LightApp_DataObject* anObject = dynamic_cast<LightApp_DataObject*>(theDataObject);
172 LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>(getApp()->activeStudy());
173 aModel->update( anObject, aStudy );
178 getApp()->objectBrowser()->setAutoUpdate( upd );
179 getApp()->objectBrowser()->updateTree( 0, false );
183 void LightApp_Module::selectionChanged()
187 /*! \brief If return false, selection will be cleared at module activation
189 bool LightApp_Module::isSelectionCompatible()
191 // return true if selected objects belong to this module
192 bool isCompatible = true;
193 #ifndef DISABLE_SALOMEOBJECT
194 SALOME_ListIO selected;
195 if ( LightApp_SelectionMgr *Sel = getApp()->selectionMgr() )
196 Sel->selectedObjects( selected );
198 LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( getApp()->activeStudy() );
199 LightApp_DataObject* aRoot = dynamic_cast<LightApp_DataObject*>( dataModel()->root() );
200 if ( aStudy && aRoot ) {
202 QString moduleDataType = aRoot->componentDataType();
203 // check data type of selection
204 SALOME_ListIteratorOfListIO It( selected );
205 for ( ; isCompatible && It.More(); It.Next()) {
206 Handle(SALOME_InteractiveObject)& io = It.Value();
207 isCompatible = ( aStudy->componentDataType( io->getEntry() ) == moduleDataType );
214 /*!Activate module.*/
215 bool LightApp_Module::activateModule( SUIT_Study* study )
217 bool res = CAM_Module::activateModule( study );
219 if ( !isSelectionCompatible() )// PAL19290, PAL18352
220 getApp()->selectionMgr()->clearSelected();
222 if ( res && application() && application()->resourceMgr() )
223 application()->resourceMgr()->raiseTranslators( name() );
225 connect( application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
226 this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
227 connect( application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
228 this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
230 if ( mySwitchOp == 0 )
231 mySwitchOp = new LightApp_SwitchOp( this );
233 // Enable Display and Erase actions
234 if ( action(myDisplay) )
235 action(myDisplay)->setEnabled(true);
236 if ( action(myErase) )
237 action(myErase)->setEnabled(true);
239 application()->shortcutMgr()->setSectionEnabled( moduleName() );
241 /* BUG 0020498 : The Entry column is always shown at module activation
242 The registration of column is moved into LightApp_Application
244 QString EntryCol = QObject::tr( "ENTRY_COLUMN" );
245 LightApp_DataModel* m = dynamic_cast<LightApp_DataModel*>( dataModel() );
248 SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( getApp()->objectBrowser()->model() );
249 m->registerColumn( getApp()->objectBrowser(), EntryCol, LightApp_DataObject::EntryId );
250 treeModel->setAppropriate( EntryCol, Qtx::Toggled );
253 if ( myIsFirstActivate ) {
254 updateModuleVisibilityState();
255 myIsFirstActivate = false;
261 /*!Deactivate module.*/
262 bool LightApp_Module::deactivateModule( SUIT_Study* study )
267 disconnect( application(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ),
268 this, SLOT( onViewManagerAdded( SUIT_ViewManager* ) ) );
269 disconnect( application(), SIGNAL( viewManagerRemoved( SUIT_ViewManager* ) ),
270 this, SLOT( onViewManagerRemoved( SUIT_ViewManager* ) ) );
272 // abort all operations
273 MapOfOperation::const_iterator anIt;
274 for( anIt = myOperations.begin(); anIt != myOperations.end(); anIt++ ) {
275 anIt.value()->abort();
278 // Disable Display and Erase action
279 if ( action(myDisplay) )
280 action(myDisplay)->setEnabled(false);
281 if ( action(myErase) )
282 action(myErase)->setEnabled(false);
284 application()->shortcutMgr()->setSectionEnabled( moduleName(), false );
286 /* BUG 0020498 : The Entry column is always shown at module activation
287 QString EntryCol = QObject::tr( "ENTRY_COLUMN" );
288 LightApp_DataModel* m = dynamic_cast<LightApp_DataModel*>( dataModel() );
291 SUIT_AbstractModel* treeModel = dynamic_cast<SUIT_AbstractModel*>( getApp()->objectBrowser()->model() );
293 treeModel->setAppropriate( EntryCol, Qtx::Shown );
294 m->unregisterColumn( getApp()->objectBrowser(), EntryCol );
297 return CAM_Module::deactivateModule( study );
300 /*! Redefined to reset internal flags valid for study instance */
301 void LightApp_Module::studyClosed( SUIT_Study* theStudy )
303 CAM_Module::studyClosed( theStudy );
305 myIsFirstActivate = true;
307 LightApp_Application* app = dynamic_cast<LightApp_Application*>(application());
309 SUIT_DataBrowser* ob = app->objectBrowser();
310 if ( ob && ob->model() )
311 disconnect( ob->model(), SIGNAL( clicked( SUIT_DataObject*, int ) ),
312 this, SLOT( onObjectClicked( SUIT_DataObject*, int ) ) );
317 void LightApp_Module::MenuItem()
322 void LightApp_Module::createPreferences()
327 void LightApp_Module::preferencesChanged( const QString&, const QString& )
332 void LightApp_Module::message( const QString& )
336 /*!Gets application.*/
337 LightApp_Application* LightApp_Module::getApp() const
339 return (LightApp_Application*)application();
343 * \brief Update something in accordance with update flags
344 * \param theFlags - update flags
346 * Update viewer or/and object browser etc. in accordance with update flags ( see
347 * LightApp_UpdateFlags enumeration ). Derived modules can redefine this method for their
350 void LightApp_Module::update( const int theFlags )
352 if ( theFlags & UF_Model )
354 if( CAM_DataModel* aDataModel = dataModel() )
355 if( LightApp_DataModel* aModel = dynamic_cast<LightApp_DataModel*>( aDataModel ) )
356 aModel->update( 0, dynamic_cast<LightApp_Study*>( getApp()->activeStudy() ) );
359 if ( theFlags & UF_ObjBrowser )
360 getApp()->objectBrowser()->updateTree( 0 );
362 if ( theFlags & UF_Controls )
364 if ( theFlags & UF_Viewer )
366 if ( SUIT_ViewManager* viewMgr = getApp()->activeViewManager() )
367 if ( SUIT_ViewWindow* viewWnd = viewMgr->getActiveView() )
369 #ifndef DISABLE_VTKVIEWER
370 #ifndef DISABLE_SALOMEOBJECT
371 if ( viewWnd->inherits( "SVTK_ViewWindow" ) )
372 ( (SVTK_ViewWindow*)viewWnd )->Repaint();
374 if ( viewWnd->inherits( "VTKViewer_ViewWindow" ) )
375 ( (VTKViewer_ViewWindow*)viewWnd )->Repaint();
378 #ifndef DISABLE_OCCVIEWER
379 if ( viewWnd->inherits( "OCCViewer_ViewWindow" ) )
380 ( (OCCViewer_ViewWindow*)viewWnd )->getViewPort()->onUpdate();
382 #ifndef DISABLE_PLOT2DVIEWER
383 if ( viewWnd->inherits( "Plot2d_ViewWindow" ) )
384 ( (Plot2d_ViewWindow*)viewWnd )->getViewFrame()->Repaint();
386 #ifndef DISABLE_GLVIEWER
387 if ( viewWnd->inherits( "GLViewer_ViewFrame" ) )
388 ( (GLViewer_ViewFrame*)viewWnd )->getViewPort()->onUpdate();
390 #ifndef DISABLE_PVVIEWER
391 // if ( viewWnd->inherits( "PVViewer_ViewWindow" ) )
392 // ( (PVViewer_ViewWindow*)viewWnd )->getViewPort()->onUpdate();
398 * \brief Updates controls
400 * Updates (i.e. disable/enable) controls states (menus, tool bars etc.). This method is
401 * called from update( UF_Controls ). You may redefine it in concrete module.
403 void LightApp_Module::updateControls()
407 /*!Create new instance of data model and return it.*/
408 CAM_DataModel* LightApp_Module::createDataModel()
410 return new LightApp_DataModel( this );
413 /*!Create and return instance of LightApp_Selection.*/
414 LightApp_Selection* LightApp_Module::createSelection() const
416 return new LightApp_Selection();
420 void LightApp_Module::onModelOpened()
425 void LightApp_Module::onModelSaved()
430 void LightApp_Module::onModelClosed()
434 /*!Gets popup manager.(create if not exist)*/
435 QtxPopupMgr* LightApp_Module::popupMgr()
439 myPopupMgr = new QtxPopupMgr( 0, this );
442 SUIT_Desktop* d = application()->desktop();
445 *disp = createAction( -1, tr( "TOP_SHOW" ), p, tr( "MEN_SHOW" ), tr( "STB_SHOW" ),
446 0, d, false, this, SLOT( onShowHide() ), QString("General:Show object(s)") ),
447 *erase = createAction( -1, tr( "TOP_HIDE" ), p, tr( "MEN_HIDE" ), tr( "STB_HIDE" ),
448 0, d, false, this, SLOT( onShowHide() ) , QString("General:Hide object(s)") ),
449 *dispOnly = createAction( -1, tr( "TOP_DISPLAY_ONLY" ), p, tr( "MEN_DISPLAY_ONLY" ), tr( "STB_DISPLAY_ONLY" ),
450 0, d, false, this, SLOT( onShowHide() ) ),
451 *eraseAll = createAction( -1, tr( "TOP_ERASE_ALL" ), p, tr( "MEN_ERASE_ALL" ), tr( "STB_ERASE_ALL" ),
452 0, d, false, this, SLOT( onShowHide() ) );
453 myDisplay = actionId( disp );
454 myErase = actionId( erase );
455 myDisplayOnly = actionId( dispOnly );
456 myEraseAll = actionId( eraseAll );
458 myPopupMgr->insert( disp, -1, 0 );
459 myPopupMgr->insert( erase, -1, 0 );
460 myPopupMgr->insert( dispOnly, -1, 0 );
461 myPopupMgr->insert( eraseAll, -1, 0 );
462 myPopupMgr->insert( separator(), -1, 0 );
464 QString oneAndNotActive = "( count( $component ) = 1 ) and ( not( activeModule in $component ) )";
465 QString uniform = "true in $canBeDisplayed and %1 and ( activeModule = '%2' )";
466 uniform = uniform.arg( oneAndNotActive ).arg( name() );
467 myPopupMgr->setRule( disp, /*QString( "( not isVisible ) and " ) + */ uniform, QtxPopupMgr::VisibleRule );
468 myPopupMgr->setRule( erase, /*QString( "( isVisible ) and " ) + */ uniform, QtxPopupMgr::VisibleRule );
469 myPopupMgr->setRule( dispOnly, uniform, QtxPopupMgr::VisibleRule );
473 #ifndef DISABLE_OCCVIEWER
474 #ifndef DISABLE_SALOMEOBJECT
475 viewers.append( SOCC_Viewer::Type() );
477 viewers.append( OCCViewer_Viewer::Type() );
480 #ifndef DISABLE_VTKVIEWER
481 #ifndef DISABLE_SALOMEOBJECT
482 viewers.append( SVTK_Viewer::Type() );
484 viewers.append( VTKViewer_Viewer::Type() );
487 #ifndef DISABLE_PLOT2DVIEWER
488 #ifndef DISABLE_SALOMEOBJECT
489 viewers.append( SPlot2d_Viewer::Type() );
491 viewers.append( Plot2d_Viewer::Type() );
495 if( !viewers.isEmpty() )
497 QString strViewers = "{ ", temp = "'%1' ";
498 QStringList::const_iterator anIt = viewers.begin(), aLast = viewers.end();
499 for( ; anIt!=aLast; anIt++ )
500 strViewers+=temp.arg( *anIt );
502 myPopupMgr->setRule( eraseAll, QString( "client in %1" ).arg( strViewers ), QtxPopupMgr::VisibleRule );
508 /*!Gets preferences.*/
509 LightApp_Preferences* LightApp_Module::preferences() const
511 LightApp_Preferences* pref = 0;
513 pref = getApp()->preferences();
517 /*!Add preference to preferences.*/
518 int LightApp_Module::addPreference( const QString& label )
520 LightApp_Preferences* pref = preferences();
524 int catId = pref->addPreference( moduleName(), -1 );
528 return pref->addPreference( label, catId );
531 /*!Add preference to preferences.*/
532 int LightApp_Module::addPreference( const QString& label, const int pId, const int type,
533 const QString& section, const QString& param )
535 LightApp_Preferences* pref = preferences();
539 return pref->addPreference( moduleName(), label, pId, type, section, param );
542 /*!Gets property of preferences.*/
543 QVariant LightApp_Module::preferenceProperty( const int id, const QString& prop ) const
546 LightApp_Preferences* pref = preferences();
548 var = pref->itemProperty( prop, id );
552 /*!Set property of preferences.*/
553 void LightApp_Module::setPreferenceProperty( const int id, const QString& prop, const QVariant& var )
555 LightApp_Preferences* pref = preferences();
557 pref->setItemProperty( prop, var, id );
561 * \brief Starts operation with given identifier
562 * \param id - identifier of operation to be started
564 * Module stores operations in map. This method starts operation by id.
565 * If operation isn't in map, then it will be created by createOperation method
566 * and will be inserted to map
568 void LightApp_Module::startOperation( const int id )
570 LightApp_Operation* op = 0;
571 if( myOperations.contains( id ) && reusableOperation( id ) )
572 op = myOperations[ id ];
575 op = createOperation( id );
578 myOperations.insert( id, op );
579 op->setModule( this );
580 connect( op, SIGNAL( stopped( SUIT_Operation* ) ), this, SLOT( onOperationStopped( SUIT_Operation* ) ) );
581 connect( op, SIGNAL( destroyed() ), this, SLOT( onOperationDestroyed() ) );
587 // be sure that operation has correct study pointer
588 op->setStudy( application() ? application()->activeStudy() : 0 );
594 * \brief Creates operation with given identifier
595 * \param id - identifier of operation to be started
596 * \return Pointer on created operation or NULL if operation is not created
598 * Creates operation with given id. You should not call this method, it will be called
599 * automatically from startOperation. You may redefine this method in concrete module to
602 LightApp_Operation* LightApp_Module::createOperation( const int id ) const
608 return new LightApp_ShowHideOp( LightApp_ShowHideOp::DISPLAY );
609 else if( id==myErase )
610 return new LightApp_ShowHideOp( LightApp_ShowHideOp::ERASE );
611 else if( id==myDisplayOnly )
612 return new LightApp_ShowHideOp( LightApp_ShowHideOp::DISPLAY_ONLY );
613 else if( id==myEraseAll )
614 return new LightApp_ShowHideOp( LightApp_ShowHideOp::ERASE_ALL );
620 * \brief Virtual protected slot called when operation stopped
621 * \param theOp - stopped operation
623 * Virtual protected slot called when operation stopped. Redefine this slot if you want to
624 * perform actions after stopping operation
626 void LightApp_Module::onOperationStopped( SUIT_Operation* /*theOp*/ )
631 * \brief Virtual protected slot called when operation destroyed
632 * \param theOp - destroyed operation
634 * Virtual protected slot called when operation destroyed. Redefine this slot if you want to
635 * perform actions after destroying operation. Base implementation removes pointer on
636 * destroyed operation from the map of operations
638 void LightApp_Module::onOperationDestroyed()
640 const QObject* s = sender();
641 if( s && s->inherits( "LightApp_Operation" ) )
643 const LightApp_Operation* op = ( LightApp_Operation* )s;
644 MapOfOperation::const_iterator anIt = myOperations.begin(),
645 aLast = myOperations.end();
646 for( ; anIt!=aLast; anIt++ )
647 if( anIt.value()==op )
649 myOperations.remove( anIt.key() );
656 Must be redefined in order to use standard displayer mechanism
657 \return displayer of module
659 LightApp_Displayer* LightApp_Module::displayer()
665 SLOT: called on activating of standard operations show/hide
667 void LightApp_Module::onShowHide()
669 if( !sender()->inherits( "QAction" ) || !popupMgr() )
672 QAction* act = ( QAction* )sender();
673 int id = actionId( act );
675 startOperation( id );
679 virtual SLOT: called on view manager adding
681 void LightApp_Module::onViewManagerAdded( SUIT_ViewManager* )
686 virtual SLOT: called on view manager removing
688 void LightApp_Module::onViewManagerRemoved( SUIT_ViewManager* )
693 \brief Returns instance of operation by its id; if there is no operation
694 corresponding to this id, null pointer is returned
695 \param id - operation id
696 \return operation instance
698 LightApp_Operation* LightApp_Module::operation( const int id ) const
700 return myOperations.contains( id ) ? myOperations[id] : 0;
704 virtual method called to manage the same operations
706 bool LightApp_Module::reusableOperation( const int id )
713 \return true if module can copy the current selection
715 bool LightApp_Module::canCopy() const
722 \return true if module can paste previously copied data
724 bool LightApp_Module::canPaste() const
731 \brief Copies the current selection into clipboard
733 void LightApp_Module::copy()
739 \brief Pastes the current data in the clipboard
741 void LightApp_Module::paste()
747 \return true if module allows dragging the given object
749 bool LightApp_Module::isDraggable( const SUIT_DataObject* /*what*/ ) const
756 \return true if module allows dropping one or more objects (currently selected) on the object \c where
758 bool LightApp_Module::isDropAccepted( const SUIT_DataObject* /*where*/ ) const
765 Complete drag-n-drop operation by processing objects \a what being dragged, dropped to the line \a row
766 within the object \a where. The drop action being performed is specified by \a action.
768 void LightApp_Module::dropObjects( const DataObjectList& /*what*/, SUIT_DataObject* /*where*/,
769 const int /*row*/, Qt::DropAction /*action*/ )
774 \brief Return \c true if object can be renamed
776 bool LightApp_Module::renameAllowed( const QString& /*entry*/ ) const
782 Rename object by entry.
783 \param entry entry of the object
784 \param name new name of the object
785 \brief Return \c true if rename operation finished successfully, \c false otherwise.
787 bool LightApp_Module::renameObject( const QString& /*entry*/, const QString& /*name*/ )
793 Update visibility state for data objects
795 void LightApp_Module::updateModuleVisibilityState()
797 // update visibility state of objects
798 LightApp_Application* app = dynamic_cast<LightApp_Application*>(SUIT_Session::session()->activeApplication());
801 SUIT_DataBrowser* ob = app->objectBrowser();
802 if ( !ob || !ob->model() ) return;
804 // connect to click on item
805 connect( ob->model(), SIGNAL( clicked( SUIT_DataObject*, int ) ),
806 this, SLOT( onObjectClicked( SUIT_DataObject*, int ) ), Qt::UniqueConnection );
808 SUIT_DataObject* rootObj = ob->root();
809 if ( !rootObj ) return;
811 DataObjectList listObj = rootObj->children( true );
813 SUIT_ViewModel* vmod = 0;
814 if ( SUIT_ViewManager* vman = app->activeViewManager() )
815 vmod = vman->getViewModel();
816 app->updateVisibilityState( listObj, vmod );
820 * \brief Virtual public slot
822 * This method is called after the object inserted into data view to update their visibility state
823 * This is default implementation
825 void LightApp_Module::onObjectClicked( SUIT_DataObject* theObject, int theColumn )
827 if ( !isActiveModule() ) return;
829 // change visibility of object
830 if ( !theObject || theColumn != SUIT_DataObject::VisibilityId ) return;
832 LightApp_Study* study = dynamic_cast<LightApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
833 if ( !study ) return;
835 LightApp_DataObject* lo = dynamic_cast<LightApp_DataObject*>( theObject );
838 // detect action index (from LightApp level)
841 if ( study->visibilityState( lo->entry() ) == Qtx::ShownState )
843 else if ( study->visibilityState( lo->entry() ) == Qtx::HiddenState )
847 startOperation( id );