From c117361cb8760d665de2891aab03cd12625335b2 Mon Sep 17 00:00:00 2001 From: ouv Date: Tue, 6 Mar 2012 13:44:11 +0000 Subject: [PATCH] PRECOS issue 0000983: External 36: Topology Window - small arrow to display the zoom options is too small --- src/GraphicsView/GraphicsView_ViewFrame.cxx | 53 ++++++++++++++++----- src/GraphicsView/GraphicsView_ViewFrame.h | 12 ++++- 2 files changed, 51 insertions(+), 14 deletions(-) diff --git a/src/GraphicsView/GraphicsView_ViewFrame.cxx b/src/GraphicsView/GraphicsView_ViewFrame.cxx index 35c43f690..459e10a8c 100644 --- a/src/GraphicsView/GraphicsView_ViewFrame.cxx +++ b/src/GraphicsView/GraphicsView_ViewFrame.cxx @@ -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 anExpandableActions; + anExpandableActions.append( myScaleAction ); + anExpandableActions.append( myPanAction ); + + QListIterator anIter( anExpandableActions ); + while( anIter.hasNext() ) + { + if( QtxMultiAction* aMultiAction = anIter.next() ) + { + QList aLocalActions = aMultiAction->actions(); + QListIterator 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 : diff --git a/src/GraphicsView/GraphicsView_ViewFrame.h b/src/GraphicsView/GraphicsView_ViewFrame.h index 6f9ab4be9..d7f86f4a8 100644 --- a/src/GraphicsView/GraphicsView_ViewFrame.h +++ b/src/GraphicsView/GraphicsView_ViewFrame.h @@ -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 -- 2.39.2