]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
PRECOS issue 0000983: External 36: Topology Window - small arrow to display the zoom...
authorouv <ouv@opencascade.com>
Tue, 6 Mar 2012 13:44:11 +0000 (13:44 +0000)
committerouv <ouv@opencascade.com>
Tue, 6 Mar 2012 13:44:11 +0000 (13:44 +0000)
src/GraphicsView/GraphicsView_ViewFrame.cxx
src/GraphicsView/GraphicsView_ViewFrame.h

index 35c43f69096081f7663ebe80c61189051055198a..459e10a8cc1cfad5de03704e0e13cf644a606ebd 100644 (file)
@@ -65,7 +65,7 @@ GraphicsView_ViewFrame::GraphicsView_ViewFrame( SUIT_Desktop* d, GraphicsView_Vi
   aLayout->addWidget( myViewPort );
 
   createActions();
-  createToolBar();
+  myToolBarId = createToolBar();
 
   connect( myViewPort, SIGNAL( vpKeyEvent( QKeyEvent* ) ),
            this, SLOT( keyEvent( QKeyEvent* ) ) );
@@ -165,24 +165,26 @@ void GraphicsView_ViewFrame::createActions()
 // Function : createToolBar
 // Purpose  : 
 //================================================================
-void GraphicsView_ViewFrame::createToolBar()
+int GraphicsView_ViewFrame::createToolBar()
 {
   int tid = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL") );
   toolMgr()->append( DumpId, tid );
 
-  QtxMultiAction* aScaleAction = new QtxMultiAction( this );
-  aScaleAction->insertAction( toolMgr()->action( FitAllId ) );
-  aScaleAction->insertAction( toolMgr()->action( FitRectId ) );
-  aScaleAction->insertAction( toolMgr()->action( FitSelectId ) );
-  aScaleAction->insertAction( toolMgr()->action( ZoomId ) );
-  toolMgr()->append( aScaleAction, tid );
+  myScaleAction = new QtxMultiAction( this );
+  myScaleAction->insertAction( toolMgr()->action( FitAllId ) );
+  myScaleAction->insertAction( toolMgr()->action( FitRectId ) );
+  myScaleAction->insertAction( toolMgr()->action( FitSelectId ) );
+  myScaleAction->insertAction( toolMgr()->action( ZoomId ) );
+  toolMgr()->append( myScaleAction, tid );
 
-  QtxMultiAction* aPanAction = new QtxMultiAction( this );
-  aPanAction->insertAction( toolMgr()->action( PanId ) );
-  aPanAction->insertAction( toolMgr()->action( GlobalPanId ) );
-  toolMgr()->append( aPanAction, tid );
+  myPanAction = new QtxMultiAction( this );
+  myPanAction->insertAction( toolMgr()->action( PanId ) );
+  myPanAction->insertAction( toolMgr()->action( GlobalPanId ) );
+  toolMgr()->append( myPanAction, tid );
 
   toolMgr()->append( toolMgr()->action( ResetId ), tid );
+
+  return tid;
 }
 
 //================================================================
@@ -194,6 +196,33 @@ QImage GraphicsView_ViewFrame::dumpView()
   return myViewPort->dumpView();
 }
 
+//================================================================
+// Function : expandToolBarActions
+// Purpose  : 
+//================================================================
+void GraphicsView_ViewFrame::expandToolBarActions()
+{
+  QList<QtxMultiAction*> anExpandableActions;
+  anExpandableActions.append( myScaleAction );
+  anExpandableActions.append( myPanAction );
+
+  QListIterator<QtxMultiAction*> anIter( anExpandableActions );
+  while( anIter.hasNext() )
+  {
+    if( QtxMultiAction* aMultiAction = anIter.next() )
+    {
+      QList<QAction*> aLocalActions = aMultiAction->actions();
+      QListIterator<QAction*> aLocalIter( aLocalActions );
+      while( aLocalIter.hasNext() )
+        if( QAction* anAction = aLocalIter.next() )
+          toolMgr()->append( anAction, myToolBarId );
+
+      int anId = toolMgr()->actionId( aMultiAction );
+      toolMgr()->remove( anId, myToolBarId );
+    }
+  }
+}
+
 //================================================================
 // Function : onViewPan
 // Purpose  : 
index 6f9ab4be9753949855f6b770caaa7569c66fa921..d7f86f4a8afa9aa2e61ebda362c26f37c4f30408 100644 (file)
@@ -31,6 +31,8 @@ class QGraphicsSceneContextMenuEvent;
 class QGraphicsSceneMouseEvent;
 class QGraphicsSceneWheelEvent;
 
+class QtxMultiAction;
+
 class SUIT_Desktop;
 
 class GraphicsView_Viewer;
@@ -57,7 +59,9 @@ public:
 
   virtual QImage          dumpView();
 
-protected slots:
+  void                    expandToolBarActions();
+
+  protected slots:
   void                    onViewPan();
   void                    onViewZoom();
   void                    onViewFitAll();
@@ -83,11 +87,15 @@ signals:
 
 private:
   void                    createActions();
-  void                    createToolBar();
+  int                     createToolBar();
 
 private:
   GraphicsView_Viewer*    myViewer;
   GraphicsView_ViewPort*  myViewPort;
+
+  int                     myToolBarId;
+  QtxMultiAction*         myScaleAction;
+  QtxMultiAction*         myPanAction;
 };
 
 #endif