-// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2022 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
myActions.insert( theId, a );
+ connect( a, SIGNAL( changed() ), this, SLOT( onActionChanged() ) );
+
return theId;
}
*/
void QtxActionMgr::unRegisterAction( const int id )
{
- if( contains( id ) )
+ if ( contains( id ) ) {
+ disconnect( myActions[id], SIGNAL( changed() ),
+ this, SLOT( onActionChanged() ) );
myActions.remove( id );
+ }
}
/*!
{
}
+/*!
+ \brief Internal action changing response operation.
+*/
+void QtxActionMgr::actionChanged( int )
+{
+}
+
/*!
\brief Called when delayed update is performed (via timer event).
updateContent();
}
+/*!
+ \brief Called when one of the registered actions changed.
+
+ Calls virtual method actionChanged() which can be redefined in the
+ subclasses to customize reaction on this.
+*/
+void QtxActionMgr::onActionChanged()
+{
+ QAction* a = ::qobject_cast<QAction*>( sender() );
+
+ int id = actionId( a );
+ if ( id != -1 )
+ actionChanged( id );
+}
+
/*!
\class QtxActionMgr::Reader
\brief Generic actions description files reader class.