X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FCAM%2FCAM_Module.cxx;h=6a8e49f3628e2d33e76c4d7c649c7ad2d534792a;hb=refs%2Fheads%2Fngr%2Fpython3_dev_pv5.4;hp=d3a0ddaf156e4187b7c48dad63da1e799466bab5;hpb=9b2087aa3c306bc98fbd5ef6344a8ab3367ae498;p=modules%2Fgui.git diff --git a/src/CAM/CAM_Module.cxx b/src/CAM/CAM_Module.cxx index d3a0ddaf1..6a8e49f36 100755 --- a/src/CAM/CAM_Module.cxx +++ b/src/CAM/CAM_Module.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 @@ -234,11 +234,10 @@ bool CAM_Module::activateModule( SUIT_Study* /*study*/ ) { // IMN 05/03/2015: we copied myActionMap for reset/unset actions accelerator keys // after activate/deactivate modules - for ( QMap, QKeySequence>::Iterator it = myActionShortcutMap.begin(); it != myActionShortcutMap.end(); ++it ) + for ( QMap::Iterator it = myActionShortcutMap.begin(); it != myActionShortcutMap.end(); ++it ) { - myActionMap.insert( it.key().first, it.key().second ); // Reset actions accelerator keys - it.key().second->setShortcut( it.value() ); + it.key()->setShortcut( it.value() ); } myActionShortcutMap.clear(); return true; @@ -263,9 +262,9 @@ bool CAM_Module::deactivateModule( SUIT_Study* ) myActionShortcutMap.clear(); for ( QMap::Iterator it = myActionMap.begin(); it != myActionMap.end(); ++it ) { - myActionShortcutMap.insert( qMakePair( it.key(), it.value() ), it.value()->shortcut() ); + myActionShortcutMap.insert( it.value(), it.value()->shortcut() ); + it.value()->setShortcut( QKeySequence() ); } - myActionMap.clear(); return true; } @@ -941,6 +940,33 @@ QAction* CAM_Module::createAction( const int id, const QString& text, const QIco 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 ); +} + +/*! + \brief Create new instance of QtxAction and register action with specified \a id. + + Resulting action ID may differ from the requested one. This can happen if + requested ID is already in use. + + If \a id < 0, the action ID is generated automatically. + + \param id required action ID + \param text tooltip text + \param icon action icon + \param menu menu text + \param tip status bar tip + \param key keyboard accelerator + \param parent parent object + \param toggle if \c true, the action will be toggled + \param reciever action activation signal receiver object + \param member action activation signal receiver slot +*/ +QAction* CAM_Module::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 );