]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
WIP
authorAnthony Geay <anthony.geay@edf.fr>
Tue, 4 Apr 2023 16:35:09 +0000 (18:35 +0200)
committerAnthony Geay <anthony.geay@edf.fr>
Tue, 4 Apr 2023 16:35:09 +0000 (18:35 +0200)
src/PV3DViewer/PV3DViewer_ViewWindow.cxx
src/SPV3D/SPV3D_ViewManager.cxx
src/SPV3D/SPV3D_ViewModel.cxx
src/SPV3D/SPV3D_ViewWindow.cxx
src/SPV3D/SPV3D_ViewWindow.h

index ca774d63dc0e903cd503ffd29175d073f881d65d..9a21c91c26c61ea9e73375554720c7b609168514 100644 (file)
@@ -57,7 +57,7 @@ PV3DViewer_ViewWindow::PV3DViewer_ViewWindow( SUIT_Desktop* theDesktop, PV3DView
   myDesktop = theDesktop;
   myModel = theModel;
   setViewManager(myModel->getViewManager());
-  myPVMgr = qobject_cast<pqTabbedMultiViewWidget*>(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
+  /*myPVMgr = qobject_cast<pqTabbedMultiViewWidget*>(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
   if (myPVMgr) {
     SUIT_Application* app = SUIT_Session::session()->activeApplication();
     if ( app )
@@ -67,7 +67,7 @@ PV3DViewer_ViewWindow::PV3DViewer_ViewWindow( SUIT_Desktop* theDesktop, PV3DView
     myPVMgr->show();
     setCentralWidget( myPVMgr );
   } else
-    qDebug("No multiViewManager defined");
+    qDebug("No multiViewManager defined");*/
 }
 
 /*!
index 89f04e9f48ab8217388a61c1260112861c82a772..70878e63ce1bb70813f2557e9135fcb8cc6a55b5 100644 (file)
@@ -38,6 +38,7 @@
 #include <pqServerResource.h>
 #include <pqView.h>
 #include <pqPVApplicationCore.h>
+#include <pqParaViewBehaviors.h>
 
 #include <QVBoxLayout>
 #include <QApplication>
@@ -56,19 +57,22 @@ SPV3D_ViewManager::SPV3D_ViewManager( SUIT_Study* study, SUIT_Desktop* theDeskto
 {
   DBG_FUN();
   setTitle( PV3DViewer_ViewManager::tr( "PARAVIEW3D_VIEW_TITLE" ) );
-  int argc = 1;
-  char *argv[2];
-  argv[0] = strdup("salome");
-  argv[1] = nullptr;
+  /*QStringList args = QCoreApplication::arguments();
+  int argc = args.length();
+  char **argv = new char *[argc+1];
+  for(auto i = 0 ; i < argc ; ++i)
+    argv[i] = strdup(args[i].toStdString().c_str());
+  argv[argc] = nullptr;
   pqPVApplicationCore appPV(argc,argv);
   QApplication::instance()->installEventFilter(&appPV);
+  new pqParaViewBehaviors(theDesktop,theDesktop);
   pqObjectBuilder *builder(pqApplicationCore::instance()->getObjectBuilder());
   pqServer *serv(pqApplicationCore::instance()->getServerManagerModel()->findServer(pqServerResource("builtin:")));
   pqView *view=builder->createView(QString("RenderView"),serv);
-  static_cast<SPV3D_ViewModel *>(this->getViewModel())->setView(view);
+  static_cast<SPV3D_ViewModel *>(this->getViewModel())->setView(view);*/
   //QVBoxLayout *lay(new QVBoxLayout(theDesktop));
   //lay->addWidget( view->widget() );
-  view->widget()->setParent( theDesktop);
+  //view->widget()->setParent( theDesktop);
   // Initialize minimal paraview stuff (if not already done)
   //PVViewer_InitSingleton::Init(theDesktop);
 
index 7e660807de79b88334268a8a2875e05eadf8ea34..dfab79f242ba40cea9ef05a8d30debc3078dac4c 100644 (file)
 #include "QtxActionToolMgr.h"
 #include "QtxBackgroundTool.h"
 
+#include <pqObjectBuilder.h>
+#include <pqApplicationCore.h>
+#include <pqServerManagerModel.h>
+#include <pqServerResource.h>
+#include <pqView.h>
+#include <pqPVApplicationCore.h>
+#include <pqParaViewBehaviors.h>
+
+#include <QApplication>
+
 // VSR: Uncomment below line to allow texture background support in PV3D viewer
 #define PV3D_ENABLE_TEXTURED_BACKGROUND
 
@@ -81,9 +91,6 @@ SPV3D_ViewModel::~SPV3D_ViewModel()
 void SPV3D_ViewModel::initialize()
 {
   DBG_FUN();
-
-  const auto* builder = pqApplicationCore::instance()->getObjectBuilder();
-  QObject::connect(builder, &pqObjectBuilder::sourceCreated, this, &SPV3D_ViewModel::onSourceCreated);
 }
 
 
@@ -96,6 +103,23 @@ SUIT_ViewWindow* SPV3D_ViewModel::createView( SUIT_Desktop* theDesktop )
   SPV3D_ViewWindow* aViewWindow = new SPV3D_ViewWindow(theDesktop, this);
 
   aViewWindow->SetSelectionEnabled( isSelectionEnabled() );
+
+  QStringList args = QCoreApplication::arguments();
+  int argc = args.length();
+  char **argv = new char *[argc+1];
+  for(auto i = 0 ; i < argc ; ++i)
+    argv[i] = strdup(args[i].toStdString().c_str());
+  argv[argc] = nullptr;
+  pqPVApplicationCore appPV(argc,argv);
+  QApplication::instance()->installEventFilter(&appPV);
+  new pqParaViewBehaviors(aViewWindow,aViewWindow);
+  pqObjectBuilder *builder(pqApplicationCore::instance()->getObjectBuilder());
+  QObject::connect(builder, &pqObjectBuilder::sourceCreated, this, &SPV3D_ViewModel::onSourceCreated);
+  pqServer *serv(pqApplicationCore::instance()->getServerManagerModel()->findServer(pqServerResource("builtin:")));
+  pqView *view=builder->createView(QString("RenderView"),serv);
+  setView(view);
+  
+  aViewWindow->init();
   
   return aViewWindow;
 }
index ea440feb59459775329f1bee7711874bfa46e2a2..bb97d3da757286b161d95fb5e10992c7918dd17d 100644 (file)
@@ -34,6 +34,8 @@
 #include <QXmlStreamReader>
 #include <QXmlStreamAttributes>
 
+#include <pqView.h>
+
 #include "QtxAction.h"
 
 #include "SUIT_Session.h"
 */
 SPV3D_ViewWindow::SPV3D_ViewWindow(SUIT_Desktop* theDesktop, SPV3D_ViewModel* theModel):
   PV3DViewer_ViewWindow(theDesktop, theModel),
-  myModel(theModel),
-  myView(NULL)
+  myModel(theModel)
 {
   DBG_FUN();
 }
 
+void SPV3D_ViewWindow::init()
+{
+  QWidget *wid = myModel->getView()->widget();
+  wid->setParent( this );
+  setCentralWidget( myModel->getView()->widget() );
+}
+
 /*!
   Destructor
 */
index 8f4411b4ca4ceee31d7d26b8a8693c6792d4f330..eeada3ec31a7c5b31dd51c31b677784e6afde7e6 100644 (file)
@@ -84,6 +84,8 @@ class SPV3D_EXPORT SPV3D_ViewWindow : public PV3DViewer_ViewWindow //SUIT_ViewWi
   //! To construct #SPV3D_ViewWindow instance
   SPV3D_ViewWindow(SUIT_Desktop* theDesktop, SPV3D_ViewModel* theModel);
 
+  void init();
+
   virtual ~SPV3D_ViewWindow();
 
   /* display */         
@@ -128,7 +130,6 @@ protected slots:
   void onMouseMoving(QMouseEvent* event);
 
 protected:
-  SPV3D_View* myView;
   SPV3D_ViewModel* myModel;
 };