]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Add fit all button
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 7 Apr 2023 13:39:10 +0000 (15:39 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 7 Apr 2023 13:39:10 +0000 (15:39 +0200)
src/PV3DViewer/PV3DViewer_ViewWindow.cxx
src/SPV3D/SPV3D_ViewWindow.cxx
src/SPV3D/SPV3D_ViewWindow.h

index 9a21c91c26c61ea9e73375554720c7b609168514..b0f14d44eae25daffe75ae0b76bd0e23a1406418 100644 (file)
 #include "MBDebug.h"
 //---------------------------------------------------------
 
-
-/*!
-  \class PV3DViewer_ViewWindow
-  \brief PVGUI view window.
-*/
-
 /*!
   \brief Constructor.
   \param theDesktop parent desktop window
@@ -57,17 +51,6 @@ PV3DViewer_ViewWindow::PV3DViewer_ViewWindow( SUIT_Desktop* theDesktop, PV3DView
   myDesktop = theDesktop;
   myModel = theModel;
   setViewManager(myModel->getViewManager());
-  /*myPVMgr = qobject_cast<pqTabbedMultiViewWidget*>(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
-  if (myPVMgr) {
-    SUIT_Application* app = SUIT_Session::session()->activeApplication();
-    if ( app )
-      app->addPostRoutine(&PV3DViewer_ViewWindow::removePVMgr);
-    myPVMgr->setParent( this );
-    // This is mandatory, see setParent() method in Qt 4 documentation
-    myPVMgr->show();
-    setCentralWidget( myPVMgr );
-  } else
-    qDebug("No multiViewManager defined");*/
 }
 
 /*!
@@ -98,7 +81,7 @@ void PV3DViewer_ViewWindow::removePVMgr()
 /*!
   \brief Returns the ParaView multi-view manager previously set with setPVManager()
 */
-pqTabbedMultiViewWidgetPV3DViewer_ViewWindow::getMultiViewManager() const
+pqTabbedMultiViewWidget *PV3DViewer_ViewWindow::getMultiViewManager() const
 {
   DBG_FUN();
   return myPVMgr;
index 855874ed19a18bb6a85cbea5a7146d4f9b54cdd8..d3e226c4d4f9ebd4b4af40535e5ed5d37d92da90 100644 (file)
 #include "QtxMultiAction.h"
 #include "QtxActionGroup.h"
 
+#include <pqCameraReaction.h>
+#include <pqParaViewBehaviors.h>
+
 #include "SALOME_ListIO.hxx"
 #include "SPV3D_Prs.h"
 
+#include <QToolBar>
+
 //---------------------------------------------------------
 #define USE_DEBUG
 #define MBCLASSNAME "SPV3D_ViewWindow"
@@ -78,6 +83,13 @@ void SPV3D_ViewWindow::init()
   QWidget *wid = myModel->getView()->widget();
   wid->setParent( this );
   setCentralWidget( myModel->getView()->widget() );
+  //
+  myToolBar = toolMgr()->createToolBar( tr("LBL_TOOLBAR_LABEL"),                       // title (language-dependant)
+                                        QString( "PV3DViewerViewOperations" ),          // name (language-independant)
+                                        false );
+  QAction* resetCenterAction =
+    toolMgr()->toolBar(myToolBar)->addAction(QIcon(":/pqWidgets/Icons/pqResetCamera.svg"), tr( "MNU_FITALL" ) );
+  new pqCameraReaction(resetCenterAction, pqCameraReaction::RESET_CAMERA);  
 }
 
 SPV3D_Prs *SPV3D_ViewWindow::findOrCreatePrs( const char* entry )
index 546eeeebe20d57f78fd4f3291e10ef1f5811186d..5a39d5bffe2b4f79b26f77092c38d534bd5cb06b 100644 (file)
@@ -139,6 +139,7 @@ protected slots:
   void onMouseMoving(QMouseEvent* event);
 
 protected:
+  int myToolBar = -1;
   SPV3D_ViewModel* myModel;
   std::list< std::pair<std::string, std::unique_ptr<SPV3D_EXPORTSPV3DData> > > myPrs;
 };