]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #681: add undo,redo,rebuild into the standard SALOME toolbar
authorasl <asl@opencascade.com>
Thu, 13 Aug 2015 09:36:59 +0000 (12:36 +0300)
committerasl <asl@opencascade.com>
Thu, 13 Aug 2015 09:37:21 +0000 (12:37 +0300)
src/NewGeom/NewGeom_Module.cpp
src/NewGeom/NewGeom_Module.h
src/XGUI/XGUI_SalomeConnector.h
src/XGUI/XGUI_Workshop.cpp

index 9a20bca77d50a7c1fb45db3b57a0df06dd21749c..cb422b659c850801ca655f136328d0d9118a3013 100644 (file)
@@ -30,6 +30,7 @@
 
 #include <QtxPopupMgr.h>
 #include <QtxActionMenuMgr.h>
+#include <QtxActionToolMgr.h>
 #include <QtxResourceMgr.h>
 
 #include <Config_PropManager.h>
@@ -455,6 +456,23 @@ void NewGeom_Module::addDesktopMenuSeparator(const char* theMenuSourceText, cons
   createMenu(separator(), aMenu, -1, theMenuPosition);
 }
 
+bool NewGeom_Module::addActionInToolbar( QAction* theAction, const QString& theToolBarTitle )
+{
+  if( !theAction )
+    return false;
+
+  SUIT_Desktop* aDesktop = application()->desktop();
+  if( !aDesktop )
+    return false;
+
+  QtxActionToolMgr* aToolMgr = aDesktop->toolMgr();
+  if( !aToolMgr )
+    return false;
+
+  aToolMgr->append( theAction, theToolBarTitle );
+  return true;
+}
+
 //******************************************************
 QList<QAction*> NewGeom_Module::commandList() const
 {
index 89cfc45a2b1930599685bfedb4dd86f7a5ba7633..7c0aa1a6eab7ca13c31f523361bfcd26bfbf7980 100644 (file)
@@ -70,6 +70,8 @@ Q_OBJECT
   virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
                                        const int theMenuPosition = 10);
 
+  virtual bool addActionInToolbar( QAction* theAction, const QString& theToolBarTitle );
+    
   virtual QMainWindow* desktop() const;
 
   virtual QString commandId(const QAction* theCmd) const;
index a7dd901c3ce600c594ae995deeda115f4588f899..742a6055bb598116e7c5a7081b92d8627d44dd5d 100644 (file)
@@ -72,6 +72,8 @@ class XGUI_EXPORT XGUI_SalomeConnector
   virtual void addDesktopMenuSeparator(const char* theMenuSourceText,
                                        const int theMenuPosition = 10) = 0;
 
+  virtual bool addActionInToolbar( QAction* theAction, const QString& theToolBarTitle ) = 0;
+
   //! Returns desktop window of SALOME
   virtual QMainWindow* desktop() const = 0;
 
index 45248744d1f134b0ced22a7de26cd085055f59db..5f6b0e9fb18123997e1ad1328aa88c74455c3299 100644 (file)
@@ -243,12 +243,17 @@ void XGUI_Workshop::initMenu()
                                                          tr("Undo last command"),
                                                          QIcon(":pictures/undo.png"),
                                                          QKeySequence::Undo, false, "MEN_DESK_EDIT");
+    QString aToolBarTitle = tr( "INF_DESK_TOOLBAR_STANDARD" );
+    salomeConnector()->addActionInToolbar( aAction,aToolBarTitle  );
+
     connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onUndo()));
     addHistoryMenu(aAction, SIGNAL(updateUndoHistory(const QList<ActionInfo>&)), SLOT(onUndo(int)));
 
     aAction = salomeConnector()->addDesktopCommand("REDO_CMD", tr("Redo"), tr("Redo last command"),
                                                 QIcon(":pictures/redo.png"), QKeySequence::Redo,
                                                 false, "MEN_DESK_EDIT");
+    salomeConnector()->addActionInToolbar( aAction, aToolBarTitle );
+
     connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onRedo()));
     addHistoryMenu(aAction, SIGNAL(updateRedoHistory(const QList<ActionInfo>&)), SLOT(onRedo(int)));
 
@@ -256,6 +261,8 @@ void XGUI_Workshop::initMenu()
     aAction = salomeConnector()->addDesktopCommand("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"),
                                                 QIcon(":pictures/rebuild.png"), QKeySequence(),
                                                 false, "MEN_DESK_EDIT");
+    salomeConnector()->addActionInToolbar( aAction, aToolBarTitle );
+
     connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onRebuild()));
     salomeConnector()->addDesktopMenuSeparator("MEN_DESK_EDIT");