Salome HOME
Fix for '23472: [CEA 2164] Display problem when ParaView isn't the first viewer'...
authorrnv <rnv@opencascade.com>
Thu, 14 Sep 2017 11:02:28 +0000 (14:02 +0300)
committerrnv <rnv@opencascade.com>
Thu, 14 Sep 2017 11:02:28 +0000 (14:02 +0300)
src/PVViewer/PVViewer_Behaviors.cxx
src/Session/SALOME_Session_Server.cxx

index d618921872f40c04349ea73cf06d6343bc905bc8..ddaae388f786fb09c1c78b37bca91b09128b8b4d 100644 (file)
@@ -36,7 +36,6 @@
 #include <pqDataTimeStepBehavior.h>
 #include <pqDefaultViewBehavior.h>
 #include <pqObjectPickingBehavior.h>
-#include <pqPersistentMainWindowStateBehavior.h>
 #include <pqPipelineContextMenuBehavior.h>
 #include <pqPluginActionGroupBehavior.h>
 #include <pqPluginDockWidgetsBehavior.h>
@@ -111,7 +110,9 @@ void PVViewer_Behaviors::instanciateAllBehaviors(QMainWindow * desk)
       new pqAutoLoadPluginXMLBehavior(this);  // auto load plugins GUI stuff
       new pqPluginDockWidgetsBehavior(desk);
       new pqPluginActionGroupBehavior(desk);
-      new pqPersistentMainWindowStateBehavior(desk);
+      // rnv: Disable ParaView main window persistance mechanism,
+      //      because SALOME has own functionality for store/restore windows state.
+      //  new pqPersistentMainWindowStateBehavior(desk);
       new pqObjectPickingBehavior(desk);
       new pqCollaborationBehavior(this);
       new pqViewStreamingBehavior(this);
index ea144e9a96cb5e33c8361aa04a21094603f751d3..c39d700e02eeff3ef43db4e43cb439eee344db17 100755 (executable)
@@ -371,12 +371,36 @@ int main( int argc, char **argv )
   }
   
 #if QT_VERSION > QT_VERSION_CHECK(5, 0, 0)
-  // initialization of the X11 visual on Linux
-  QSurfaceFormat format;
-  format.setDepthBufferSize(16);
-  format.setStencilBufferSize(1);
-  format.setProfile(QSurfaceFormat::CompatibilityProfile);
-  QSurfaceFormat::setDefaultFormat(format);
+
+  // RNV: setup the default format:
+  // QSurfaceFormat should be set before creation of QApplication,  
+  // so to avoid conflicts beetween SALOME and ParaView QSurfaceFormats we should merge theirs formats
+  // (see comments below) and set the resultant format here.
+  
+  // Settings from Paraview: 
+  // This piece of code was taken from QVTKOpenGLWidget::defaultFormat() method in
+  // order to avoid dependency of the SALOME_Session_Server on vtk libraries
+  QSurfaceFormat fmt;
+  fmt.setRenderableType(QSurfaceFormat::OpenGL);
+  fmt.setVersion(3, 2);
+  fmt.setProfile(QSurfaceFormat::CoreProfile);
+  fmt.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
+  fmt.setRedBufferSize(1);
+  fmt.setGreenBufferSize(1);
+  fmt.setBlueBufferSize(1);
+  fmt.setDepthBufferSize(1);
+  fmt.setStencilBufferSize(0);
+  fmt.setAlphaBufferSize(1);
+  fmt.setStereo(false);
+  fmt.setSamples(0);
+
+  // Settings for OCCT viewer window:
+  fmt.setDepthBufferSize(16);
+  fmt.setStencilBufferSize(1);
+  //  fmt.setProfile(QSurfaceFormat::CompatibilityProfile);
+
+  QSurfaceFormat::setDefaultFormat(fmt);
+
 #endif
 
   // Create Qt application instance;