X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSUIT%2FSUIT_Application.cxx;h=06d9180ed8138cd4a388437a8f8014578d1d4de2;hb=efe3cdefadc31ad9cdaa9fd7fc368e2931cebdf1;hp=cf33187fb809e4940d850641155c543f2ee2b1a0;hpb=bbc5c50035b23e5c74dd2ba28468a6adede1abbc;p=modules%2Fgui.git diff --git a/src/SUIT/SUIT_Application.cxx b/src/SUIT/SUIT_Application.cxx old mode 100755 new mode 100644 index cf33187fb..06d9180ed --- a/src/SUIT/SUIT_Application.cxx +++ b/src/SUIT/SUIT_Application.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 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 @@ -58,7 +58,8 @@ SUIT_Application::SUIT_Application() : QObject( 0 ), myStudy( 0 ), myDesktop( 0 ), - myStatusLabel( 0 ) + myStatusLabel( 0 ), + myPostRoutines( QList() ) { if ( SUIT_Session::session() ) SUIT_Session::session()->insertApplication( this ); @@ -74,6 +75,9 @@ SUIT_Application::~SUIT_Application() delete s; setDesktop( 0 ); + + foreach ( PostRoutine routine, myPostRoutines ) + routine(); } /*! @@ -630,6 +634,28 @@ QAction* SUIT_Application::createAction( const int id, const QString& text, cons const QString& menu, const QString& tip, const int key, QObject* parent, const bool toggle, QObject* reciever, const char* member, const QString& shortcutAction ) +{ + return createAction( id, text, icon, menu, tip, QKeySequence(key), parent, toggle, reciever, member, shortcutAction ); +} + +/*! + Creates action and registers it both in menu manager and tool manager + \return new instance of action + \param id - proposed SUIT identificator + \param text - description + \param icon - icon for toolbar + \param menu - menu text + \param tip - tool tip + \param key - shortcut + \param parent - parent object + \param toggle - if it is TRUE the action will be a toggle action, otherwise it will be a command action + \param reciever - object that contains slot + \param member - slot to be called when action is activated +*/ +QAction* SUIT_Application::createAction( const int id, const QString& text, const QIcon& icon, + const QString& menu, const QString& tip, const QKeySequence& key, + QObject* parent, const bool toggle, QObject* reciever, + const char* member, const QString& shortcutAction ) { QtxAction* a = new QtxAction( text, icon, menu, key, parent, toggle, shortcutAction ); a->setStatusTip( tip ); @@ -667,7 +693,8 @@ int SUIT_Application::registerAction( const int id, QAction* a ) if ( desktop() && desktop()->toolMgr() ) desktop()->toolMgr()->registerAction( a ); - if ( desktop() ) + if ( desktop() && a->shortcutContext() != Qt::WidgetShortcut && + a->shortcutContext() != Qt::WidgetWithChildrenShortcut ) desktop()->addAction( a ); return ident; @@ -705,3 +732,9 @@ void SUIT_Application::onHelpContextModule( const QString& /*theComponentName*/, const QString& /*theContext*/ ) { } + +void SUIT_Application::addPostRoutine( PostRoutine theRoutine ) +{ + if ( !myPostRoutines.contains( theRoutine ) ) + myPostRoutines << theRoutine; +}